Editor allows incorrect scripts to be assigned to exported properties

Godot Version

4.0.0

Question

I’m running into a major workflow issue regarding the Godot editor allowing incorrect script types to be assigned to exported properties. (I’m using C#)

In my case, I have a class called FocusButton which inherits from Control as it’s a UI element. When I create an exported property in my ShopMenu class which contains multiple exported FocusButtons the editor allows me to assign any node to this property, even if it does not have the FocusButton script attached.

Nodes without the FocusButton script are being mistakenly being assigned to exported FocusButton properties and the Godot editor is allowing this and then throwing errors at run time when the correct script isn’t assigned.

show us your code. are you using the [Export] c# attribute?

1 Like