Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Update serialized property name #165

Open
tylkomat opened this issue Sep 24, 2020 · 0 comments
Open

[Question] Update serialized property name #165

tylkomat opened this issue Sep 24, 2020 · 0 comments

Comments

@tylkomat
Copy link

tylkomat commented Sep 24, 2020

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?

@tylkomat tylkomat changed the title [Question] Update property name [Question] Update serialized property name Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant