Localization 1.2.1 can not serialize LocalizedString

when adding a wrapper that contains a localized string in our savefile we get the following error trying to serialize the save. Where the parent class LocalizedReference of LocalizedString does contain:

public Locale LocaleOverride { get; set; }

and although LocalizedReference does implement ISerializationCallbackReceiver
so my guess its a bug…

8242692--1078047--upload_2022-6-30_9-3-8.png

Locale override is a field that should not be serialized. It looks like your system is trying to serialize it, can you tell it to ignore that field?

Hi @karl_jones
we.re trying to serialize the unity class LocalizedString.cs
this is the class in 0.8.0 (already converted back so can not check in 1.2.1 anymore)

but so if u would try to serialize it in 1.2.1 it will throw and error that it can not serialize locale
which wasn’t present in 0.8.0’s LocalizedReference

Yes LocaleOverride was added after 0.8. A locale is a Scriptable object and should not be serialized. They are loaded at runtime and should be assigned afterwards.
Can you ignore this field?

unfortunately not, since it is in the unity native file LocalizedReference and it makes LocalizedString unserializable, which we need. Ignoring this field would mean we have re-write a big part of our generated assets system. so i guess we’ll stick with 0.8.0.

Alternatively you could modify the package to remove that field. If you move the package out of the package cache folder and into the package project folder you can make changes.

1 Like