godot-extended-libraries / godot-next

Godot Node Extensions - Basic Node Extensions for Godot Engine
MIT License
957 stars 61 forks source link

add object freezer + object freezer demo #104

Closed FireSquid6 closed 2 years ago

FireSquid6 commented 2 years ago

Adds an object freezer object to make saving objects easier. This is my first time contributing, so feel free to lmk if I did something stupid and need to change stuff.

willnationsdev commented 2 years ago

Thanks for your submission! Looking over this though, I'm not quite sure if this type is really needed. Are you familiar with the dict2inst and inst2dict global functions in the @GDScript namespace? These automatically perform the serialization process you've implemented by hand in script code.

And if what one needs is just to save an object's data to a file, they can simply save/load the object to a file in whatever custom method they need while using var2bytes / bytes2var to handle serialization to/from a PoolByteArray / PackedByteArray (4.0).

FireSquid6 commented 2 years ago

oh lol, dict2inst and inst2dict didn't show up in my original google search when I went through pain trying to figure out how to save my game. Thanks for letting me know.