Scene Components
Last updated
Last updated
Using Logic, you can reference scene-specific components or game objects.
Go to the Components type in the Databrain editor and create a new data object.
Select the newly created data object. You can now define the component type by clicking on the dropdown button.
Now, when assigning a graph to a logic controller component in the scene, the inspector shows you all available scene components. You can assign the references here.
You can organize your components by simply creating a new class file and deriving from SceneComponent. Like in following example:
To access a component in your custom node, simply create a reference of type SceneComponent like this:
You can use the DataObjectDropdown attribute to specify the scene component type:
In your node execute method you can then access the assigned component using GetReference<T>(NodeData node)