Export specific custom classes

In the state machine class we use the Node class when we refer to the class of our states and our state array. This works, but in the editor when we go to add the nodes to the array, the Godot editor lets us add any of the nodes from that scene into an array.

I tried changing the Node reference to a CharacterState, but the editor still let me add any node I wanted into the array. Is there a way to set up the export so that if I typed

[Export] private CharacterState initialState

that it only let me add nodes whose scripts inherit from CharacterState?

I fooled around in GDScript for a few minutes and was able to get it to work, but couldn’t in C#. It’s not the end of the world, but it does bug me lol.

Disregard, someone on the Godot discord was able to explain. Marking the CharacterState class with the [GlobalClass] attribute fixed the issue

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms