Godot Version
4.3
Question
I am implementing a custom inspector using C#. In the _ParseBegin(GodotObject @object) function, I want to access the C# script ‘MyNode’ attached to the node with the @object parameter.
I found this is only possible if I add the [Tool] attribute to the class which inherits from node.
Now the @object is of type ‘MyNode’ as long as the game isn’t running or i am in the ‘local’ view while the game is running.
This following code writes ‘parse begin for type MyNode’ in that case.
public override void _ParseBegin(GodotObject @object)
{
Label label = new Label { Text = $"parse begin for type " + @object.GetType() };
AddCustomControl(label);
}
However, when I switch to ‘remote’ with the game running and inspect the node, the text now says the type is ‘Godot.GodotObject’. Thep roblem is that I now don’t know how to get the the actual instance of my script/node so that I can display my custom controls which require access to the fields of the class.
Why does this behave differently in the remote window and how can I get my reference to my node/my class inheriting from node at runtime?
Thanks