#Why are Objects serialised by ResourceFormatSaverText but not ResourceFormatSaverBinary

1 messages · Page 1 of 1 (latest)

deep wave
#

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!

grizzled ibex
#

It doesn't save objects because they're not resources, its simple as that

deep wave
#

Why does the ResourceFormatSaverText save them then ?

grizzled ibex
#

whats the output of that

violet flint
#

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.

rugged rapids
grizzled ibex
rugged rapids
#

yep you are right

#

this link i send is just an uh abstract base class