godotengine / godotengine/godot-cpp
Exported/registered properties periodically get reset to default values
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 809
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 8
Description
I've been dealing with the exasperating problem of my registered/exported class properties getting reset to their default values in the editor every so often. For example, here's one that happens practically every time I open Godot after a few days: I have this `Ref` to a custom class declared in a header:
```cpp
Ref enemy_group;
```
And this register property declaration in `_register_methods` in the source:
```cpp
register_property("enemy_group", &Battle::enemy_group, Ref(), GODOT_METHOD_RPC_MODE_DISABLED, GODOT_PROPERTY_USAGE_DEFAULT, GODOT_PROPERTY_HINT_RESOURCE_TYPE, "Resource");
```
The fact that it involves a custom class or a Ref doesn't seem like the issue, because it's also happened with simple ints, floats, and Strings as well. It's also happened with things that don't have property hints. Also, with things that use Refs, I've tried both `Ref()` and `nullptr` as defaults, and it happens in both cases.
It seems to affect some classes more than others, mainly the ones I've been actively editing. I have a lot of classes that derive from `Resource` that just exist in the filesystem and not as nodes, and it doesn't seem to be affecting anything exported in them. That being said, I haven't been actively editing the class I've given as an example here, and sometimes I'll just close Godot and open it several days later having done nothing, and everything still gets reset. This class I've shown here is in the main scene, so maybe just saving the scene can cause it to happen?
I've looked all over the internet, the issues for this repo, and the gdnative channel in the Discord, and I haven't found anyone else talking about this, so I'm wondering if I'm just missing something or doing something wrong. Anyone have any ideas?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.