godot-cpp
godot-cpp copied to clipboard
Can't bind user-defined type if it doesn't inherit from Object
Assume that I have a class which do not inherit from anything
class UserDefineType
{
// Some properties.
};
There is no way that I can ADD_PROPERTY to use it in GDScript/C# as it requires PropertyInfo must be one of the variant type.
@nongvantinh Which Godot version are you using?
I'm testing in both Godot 3.4.2 and 4.0 using 3.x and master. If there is some way it should mention some where. As a user I have no glue.
I am misunderstanding this use case, It is not the way Godot works. I must inherit from Reference or its derived class just like C# to make it work. It seems like this is also the way Godot Module works.
We should mention this somewhere in the usage document.
I must inherit from Reference or its derived class just like C# to make it work.
You can probably inherit from Object too (if you don't need reference counting).