Open me2beats opened 4 years ago
From what I can see, this method is not usable in its current state (apart from the current issue, it's implemented for the editor only, so it does nothing in an exported game).
When adding print(get_script().get_script_property_list())
to the same script, the output is:
[{class_name:, hint:0, hint_string:, name:a, type:0, usage:8192}]
So it would make sense for get_property_default_value()
to return the expected value.
This method needs to be functional, unexposed from scripts or better documented.
Link to the doc: https://docs.godotengine.org/en/stable/classes/class_script.html#class-script-method-get-property-default-value
It should probably be unexposed. It's probably not doing what you expect it to do - for var a = 1
, it would likely return the default value of Variants, which is indeed null
. var a = 1
assigns a value, but not a "default" value as meant in this method, which is used to define what properties can revert to in the Inspector.
CC @bojidar-bg
that is, if I understood correctly this method cannot be used in GDScript?
then imo this should at least be stated in the documentation (that this method cannot be used in gdscript).
This is still around in 4.3, btw.
Would really like a method for this, and to remove the current method. The docs don't really explain what this method is really doing.
The default value of Variant
being null seems to be not that useful, but actually getting the default value (as you would expect by the name) would be more useful.
Godot version:
3.2.2 stable
OS/device including version:
Windows
Issue description:
return the property default value, getting
Null
insteadSteps to reproduce:
Minimal reproduction project:
not required