Scene Components
Using Logic, you can reference scene-specific components or game objects.
Define components
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.

public class PlayerComponents : SceneComponent {}

Access component in nodes
To access a component in your custom node, simply create a reference of type SceneComponent like this:
public SceneComponent playerObject;
You can use the DataObjectDropdown attribute to specify the scene component type:
[DataObjectDropdown(true, sceneComponentType: typeof(GameObject))]
public SceneComponent playerObject;
In your node execute method you can then access the assigned component using GetReference<T>(NodeData node)
// adding true to include all derived types of SceneComponent
[DataObjectDropdown(true, sceneComponentType: typeof(GameObject))]
public SceneComponent playerObject;
public override void ExecuteNode()
{
var _playerObject = playerObject.GetReference<GameObject>(this);
}
Last updated