Skip to content

Calling Serializer In Editor Broken #3

Description

@TristanLMartin

Hello I was trying to make a way for devs working on my project to save debug settings in the editor through the @export_button_tool feature and a @tool script. Unfortunately this wasn't working, it was having issues where it couldn't find the script after saving it. After a bit of debugging I learned that Godot doesn't seem to persist the static variables that you have declared at the top of the serializer.

Reinstating them before I use the serializer code was what I figured out as a workaround, something like this

# Ensure static fields are properly initialized
ObjectSerializer.type_field = "._type"
ObjectSerializer.args_field = "._"
ObjectSerializer.object_type_prefix = "Object_"
var serialized: PackedByteArray = BinarySerializer.serialize_bytes(data)

Hope this helps in case you or someone else bumps into this issue in the future!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions