Skip to content

[Question] Update serialized property name #165

@tylkomat

Description

@tylkomat

Currently we have some ScriptableObjects that are referenced by their name. This comes with some issues as names may change and also they don't have to be unique. We would like to switch to UUIDs.

using FullSerializer;

[System.Serializable]
[fsObject(Converter = typeof(CharacterDataConverter))]
public class CharacterData
{
  public CharacterSO player;
  public CharacterSO mentor;
}

The mentor field is currently serialized as mentorName. With the changes the serialized field name would be mentorUid. This is handled by the CharacterDataConverter, but this has to be updated all the time when CharacterData class changes and is often forgotten.

Much simpler would be to use fsProperty:

using FullSerializer;

[System.Serializable]
public class CharacterData
{
  [fsProperty(Converter = typeof(PlayerConverter)]
  public CharacterSO player;
  [fsProperty(Converter= typeof(CharacterSOConverter), Name="mentorName")]
  public CharacterSO mentor;
}

But this can handle only either mentorName or mentorUid.
Is there another solution? Maybe using versioning?

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