Hi peeps. I'm writing an extension through the C++ GDExtension.
I have a Resource type that holds an array of Objects, which I basically use as structs. This worked fine for testing in-editor with a .tscn as the Objects did get serialised. However when I tried to test in an exported game, my objects were null. Some debugging later, I find that ResourceFormatSaverBinary simply does not save Objects if they are not Resources.
Why the discrepancy? And is there a way to serialise Objects or some other form of struct in binary to avoid the resource-wasting repetition of SubResources?
Thanks!
#Why are Objects serialised by ResourceFormatSaverText but not ResourceFormatSaverBinary
1 messages · Page 1 of 1 (latest)
It doesn't save objects because they're not resources, its simple as that
Why does the ResourceFormatSaverText save them then ?
whats the output of that
Could specify a packedbytearray for export (editor-hidden) and use it's encode/decode functions.
But if this subresource array size is less than 100 items, you may as well make them Resources, as Objects are heap-allocated anyway so it's practically the same.
Godot Engine documentation
Inherits: RefCounted< Object Saves a specific resource type to a file. Description: The engine can save resources when you do it from the editor, or when you use the ResourceSaver singleton. Thi...
this is an abstract class, it doesn't do anything by itself