> For the complete documentation index, see [llms.txt](https://giantgrey.gitbook.io/databrain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://giantgrey.gitbook.io/databrain/attributes/field-attributes.md).

# Field attributes

### DataObjectDropdown

<div align="left"><figure><img src="https://2348672745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIoqF5QAgQsqxrjmTIKpE%2Fuploads%2FeZcUufcHofYKHZUBoi4e%2Fobjectdropdown.gif?alt=media&amp;token=239ad33e-8f4c-4038-b949-626a54c52e4e" alt=""><figcaption></figcaption></figure></div>

Enables a useful dropdown field with additional features such as unassign, create new and find DataObject. When using this attribute outside of a DataObject - like in a MonoBehaviour, it is necessary to add a reference to the DataLibrary object and pass the name of the DataLibrary field.

* dataLibraryFieldName: the name of the data library field
* includeSubtypes: if true, dropdown also shows derived types
* tooltip: set an additional etooltip

```csharp
public class Enemy : MonoBehaviour
{
    public DataLibrary data;
    
    [DataObjectDropdown("data")]
    public EnemyData enemyData;
}
```

### ExposeToInspector

<figure><img src="https://2348672745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIoqF5QAgQsqxrjmTIKpE%2Fuploads%2FXn9h0B65b0q0hukALcMb%2FquickAccess.gif?alt=media&amp;token=d8d56190-dbcb-4a56-bd7f-032ca25b536c" alt=""><figcaption></figcaption></figure>

Use the ExposeToInspector attribute to mark fields which should be displayed in the popup inspector on the DataObjectDropdown property drawer.

```csharp
public EnemyData : DataObject
{
       [ExposeToInspector]
       public int health;
       [ExposeToInspector]
       public int speed;
       [ExposeToInspector]
       public GameObject prefab
       
       public Vector3 position;
}
```

### DatabrainSerialize

Mark fields which should be serialized by Databrain to a file with the \[DatabrainSerialize] attribute. Only fields of DataObjects which are in the runtime-DataLibrary will be serialized.

<pre class="language-csharp"><code class="lang-csharp"><strong>[DataObjectAddToRuntimeLibrary]
</strong><strong>public EnemyData : DataObject
</strong>{
       [ExposeToInspector]
       [DatabrainSerialize]
       public int health;
       [ExposeToInspector]
       [DatabrainSerialize]
       public int speed;
       [ExposeToInspector]
       public GameObject prefab
       
       [DatabrainSerialize]
       public Vector3 position;
}
</code></pre>

### Border

<div align="left"><figure><img src="https://2348672745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIoqF5QAgQsqxrjmTIKpE%2Fuploads%2FkqbVtHnazg84cLRvkhgc%2FborderAttribute.png?alt=media&amp;token=aa0ece0b-c3a4-4b28-959a-585539cbaf31" alt=""><figcaption></figcaption></figure></div>

Set a border around a field

* borderWidth: The width of the border
* color: The color of the border

### HorizontalLine

<div align="left"><figure><img src="https://2348672745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIoqF5QAgQsqxrjmTIKpE%2Fuploads%2FWGrEMGVQjQ9r2EcXnHvQ%2FhorizontalLineAttribute.png?alt=media&amp;token=f740aa8f-1a81-4fa8-aaba-1983e0e45e66" alt=""><figcaption></figcaption></figure></div>

Create a horizontal line with custom width and color

* height: height of the line
* color: color of the line (DatabrainColor)

### Dropdown

<div align="left"><figure><img src="https://2348672745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIoqF5QAgQsqxrjmTIKpE%2Fuploads%2F7uCMrc1TmFgO8UN6OPhT%2FdropdownAttribute.png?alt=media&amp;token=28982ae6-14e8-4f33-a676-2d8083dadd64" alt=""><figcaption></figcaption></figure></div>

Create a dropdown selection

```csharp
// string
private List<string> dropdownOptions = new List<string> { "A", "B", "C" };

[Dropdown("dropdownOptions")]
public string dropdown;

// integer
private List<int> dropdownIntOptions = new List<int> { 0, 1, 2 };

[Dropdown("dropdownIntOptions")]
public int dropdownNumber;
```

### Foldout

Group fields by foldouts (only works in the Databrain editor)

```csharp
[Foldout("curves")]
public AnimationCurve curve1;
[Foldout("curves")]
public AnimationCurve curve2;

[Foldout("Numbers")]
public int numberOne;
[Foldout("Numbers")]
public int numberTwo;
```

### InfoBox

<div align="left"><figure><img src="https://2348672745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIoqF5QAgQsqxrjmTIKpE%2Fuploads%2FndonjzVQv39TvOKWw9B8%2FinfoBoxAttribute.png?alt=media&amp;token=205289e4-95d8-43b2-ad14-2e6e582201ee" alt=""><figcaption></figcaption></figure></div>

Shows an info box.

* infoBoxtype: The type of the infoBox (InfoBoxType.Normal / InfoBoxType.Warning / InfoBoxType.Error
* text: The text message

### EnumFlags

<div align="left"><figure><img src="https://2348672745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIoqF5QAgQsqxrjmTIKpE%2Fuploads%2Fcgz2FDMJaGtKIhA2GITK%2FenumFlagAttribute.png?alt=media&amp;token=8d840470-8653-47d5-9b7e-4f4863ccf976" alt=""><figcaption></figcaption></figure></div>

Shows an enum selection toggle group for choosing multiple enums.

```csharp
public enum TerrainType
{
    none = 0,
    sand = 1,
    earth = 2,
    water = 4,
    rock = 8
}

[EnumFlags]
public TerrainType terrainType;
```

### Hide

Hides a field

### Layer

Shows a layer dropdown.

```csharp
[Layer]
public string layer;
[Layer]
public int layerInt;
```

### Slider

Create a slider with min and max value

### Scene

Create a scene dropdown field

### ShowAssetPreview

<div align="left"><figure><img src="https://2348672745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIoqF5QAgQsqxrjmTIKpE%2Fuploads%2Fvqr7c26YjIJvQR5fqXQY%2FassetPreviewAttribute.png?alt=media&amp;token=3ed59798-53aa-4a81-a222-9bb4990b82c9" alt=""><figcaption></figcaption></figure></div>

Creates a preview window of assigned game object

* width
* height

### Tag

Creates a tag dropdown field.

```csharp
[Tag]
public string tag;
```

### Textfield

Creates a multiline textfield

### Title

Adds a title to the field with an optional border.

* title
* borderColor
* textColor
