> 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/api/dataobject.md).

# DataObject

## Runtime Methods

### CloneToRuntimeContainer

Clone this DataObject directly to its related runtime-DataLibrary

* \_ownerGameObject: An initial data object can have multiple runtime clones. When passing the owner game object, the runtime clone can be linked to this owner game object which makes it possible to retrieve the runtime clone by the owner game object.

### OnStart

Called on start after DataLibrary has been initialized

### OnEnd

Called after DataLibrary has been disabled

### GetSerializedData

Override this method to return the serialized data object class of your custom DataObject to make sure the data gets serialized as json when saving to a file.

### SetSerializedData

Gets called after the DataLibrary has loaded the json file. The \_data object contains the serialized data object.

### GetRuntimeDataObject

Return the runtime DataObject

* \_ownerGameObject: Provides the owner game object if the runtime DataObject has been cloned manually at runtime, otherwise the first in the list will be returned (which is usually the runtime clone which has been cloned automatically if data type has been set to be added to the runtime library in the editor).

### GetAllRuntimeDataObjectsFromThisType

Return all runtime DataObjects of the same type as this DataObject

### GetAllRuntimeDataObjectsFromThis

Return all runtime DataObjects which have been cloned from this DataObject

### GetInitialDataObject

Return the initial data object

### SetNewGuid

Set a new guid. Only for runtime data objects. This can be useful when creating new instances from GetAllRuntimeDataObjects, as newly created game objects will have a different guid.

## Editor Methods

### CustomGUI

Create custom GUI for this DataObject using UIElements

### Reset

Editor method. Resets the DataObject. Must be overridden in order to reset all custom values.

### Selected

Editor method which gets called when DataObject gets selected in the Databrain editor

### OnDelete

Editor method which gets called when a DataObject gets deleted in the Databrain editor

### IsValid

Editor method where you can return true or false if this DataObject is valid. If it returns as false, an exclamation mark is shown in the Databrain object list view.

### ConvertFromCSV

Override this method to manually convert CSV string data to your custom DataObject
