Custom GUI
Custom editor GUI
Databrain supports custom UI for your DataObject, made with the new Unity UIElements. You can create quite complex UIs with it which is also how we have created the node editor for the Logic and Techtree addons, for example.
Since version 1.1.0 it is now possible to also use Odin Inspector attributes to create custom editor GUI's. Read more
To create a custom UI with UIToolkit, simply override from EditorGUI in your DataObject class. See the following example:
Some notes regarding this script:
If you're using editor specific methods (like BindProperty), make sure to encapsulate the EditorGUI method in to the #if UNITY_EDITOR directive. The same goes for the UnityEditor namespace.
You usually don't want to show the default inspector when using a custom GUI. You can hide all fields by using the DataObjectHideAllFields attribute on the class
Custom runtime GUI
It is also possible to create a custom runtime GUI for a DataObject class. Simply override from RuntimeGUI in your DataObject class.
Here's a simple example:
You will then have to use it in a custom Monobehaviour script which adds the RuntimeGUI to a UIDocument like this:
Add this script to an empty GameObject in the scene and make sure to assign a UIDocument to the document variable.
Last updated