Forum rules - please read before posting.

Possible bug: AC.OptionsData.LoadPrefs throws NullReferenceException

On the Windows Phone platform Serializer.SerializeObjectBinary returns an empty string, and Serializer.DeserializeObjectBinary<T> returns null, resulting in AC.options.LoadPrefs throwing a NullReferenceException, at least in the editor when on the Windows Phone build target, and on the Windows Phone itself.

OptionsData is both serialized and stored in Options and SettingsManager.

A possible fix would be to check #if UNITY_WP8 || UNITY_WINRT on serialization/deserialization of OptionsData or use SaveSystem.GetSaveMethod(), and use XML serialization instead, in both Options and SettingsManager. An even better fix is to generalise the Serializer Serialize* and Deserialize* into a single method, and let only the serializer handle what method to call in the background.

Comments

  • Thanks for the suggestion - but SaveSystem.GetSaveMethod() does use return XML if you're on the UNITY_WINRT platform.  At least in the more recent versions - are you using v1.45?
  • The result of SaveSystem.GetSaveMethod() is correct indeed, but the error is the Options data is always serialized to binary in both Options and SetttingsManager, no matter what platform one is running on, and this fails on WINRT and WP8 - it results in a NullReferenceException when deserializing.

    I am using 1.44, and currently not able to upgrade, since we have made several changes to the source code.
  • OK.  I was made aware of this issue separately, and it will be fixed in the next release.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.