Databrain Documentation
databrain.ccDiscord
  • Welcome
  • Installation / Update
  • Interface
  • DataObject Property Drawer
    • No GUI Implemented - FIX
  • Getting started
  • Guides
    • Add data objects
    • Add data objects at runtime
    • Get initial data
    • Get/Set runtime data
    • Serialize DataObjects
    • Runtime Save & Load
    • Use custom serializer
    • Import
    • Search
    • Custom GUI
    • Custom GUI with Odin Inspector
    • Hierarchy Template
  • Separate DataObjects
  • Using Version Control
  • Attributes
    • DataObject attributes
    • Field attributes
  • API
    • DataLibrary
    • DataObject
  • FAQ
    • Databrain - FAQ
  • Add-ons
    • Events
    • Blackboard
    • Logic
      • Interface
      • Create Graph
      • Execute graph
      • Control flow execution in groups
      • Custom Nodes
        • Asynchronous execution
        • Node Attributes
      • Scene Components
      • Graph Events
      • Finite State Machine
        • Create custom Actions
        • Examples
        • State Machine Nodes
    • Stats
      • Achievements
      • Modifiers
      • Values
      • Progressions
      • Components
      • Nodes
    • Progress
      • Progress Settings
      • Progress Graph
      • Progress Resources
      • Runtime UI Setup
      • API
        • ProgressController
    • Techtree (LEGACY)
      • Techtree Manager
      • Techtree
      • TechtreeResource
      • Techtree UIBuilder
        • Custom Techtree Node Button
        • Tooltip
      • API
    • Localization
      • Localization Manager
      • Localization
      • Examples
      • Components
      • Import
      • API
    • Inventory
      • Getting started
      • Demo
      • Data setup
        • Inventories
        • Slot IDs
        • Items
          • Blueprints
          • Item rarities
        • Money
        • Loot tables
        • Events
      • Runtime UI
        • Setup
    • Dialogue
      • Getting Started
        • Demo
      • Dialogue runtime setup
      • Actors
        • Emotions
      • Localization
      • Audio
      • Animation
      • Variables
      • Custom theme
      • Import
      • Nodes
      • API
        • DialogueController
        • IDialogueUIControl
  • Changelog
    • Databrain - Changelog
      • 1.4.0
      • 1.3.2
      • 1.3.1
      • 1.3.0
      • 1.2.0
      • 1.1.0
      • 1.0.10
      • 1.0.9
      • 1.0.8
      • 1.0.7
      • <= 1.0.6
Powered by GitBook
On this page
  • DataObjectDropdown
  • ExposeToInspector
  • DatabrainSerialize
  • Border
  • HorizontalLine
  • Dropdown
  • Foldout
  • InfoBox
  • EnumFlags
  • Hide
  • Layer
  • Slider
  • Scene
  • ShowAssetPreview
  • Tag
  • Textfield
  • Title
  1. Attributes

Field attributes

PreviousDataObject attributesNextDataLibrary

Last updated 10 months ago

DataObjectDropdown

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

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

ExposeToInspector

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

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.

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

Border

Set a border around a field

  • borderWidth: The width of the border

  • color: The color of the border

HorizontalLine

Create a horizontal line with custom width and color

  • height: height of the line

  • color: color of the line (DatabrainColor)

Dropdown

Create a dropdown selection

// 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)

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

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

InfoBox

Shows an info box.

  • infoBoxtype: The type of the infoBox (InfoBoxType.Normal / InfoBoxType.Warning / InfoBoxType.Error

  • text: The text message

EnumFlags

Shows an enum selection toggle group for choosing multiple enums.

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.

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

Slider

Create a slider with min and max value

Scene

Create a scene dropdown field

ShowAssetPreview

Creates a preview window of assigned game object

  • width

  • height

Tag

Creates a tag dropdown field.

[Tag]
public string tag;

Textfield

Creates a multiline textfield

Title

Adds a title to the field with an optional border.

  • title

  • borderColor

  • textColor