Godot Version
v4.2.1.stable.mono.official [b09f793f5]
Question
I’m using ˙protobuf-net
for game state persistence, which requires registering custom classes, and this includes having to list the property names I wish to include.
For Godot’s `Vector3 this is what I need to do:
RuntimeTypeModel.Default.Add(typeof(Vector3), false).Add("X", "Y", "Z");
Thankfully, the .Add method also accepts a string[]
, so for my more complex classes I can collect the property names like so:
RuntimeTypeModel.Default.Add(typeof(MyClass)).Add(MyClass.GetGodotPropertyList().Select(p => p.Name.ToString()).ToArray());
This works, but an ominous warning concludes the documentation of the GetGodotPropertyList
method: “Do not call this method.”
Why?
If it’d awake and invoke the Great Cthulhu (and we obviously don’t want that), how would I collect the property names of my classes?