Hi there. I’m trying to build my existing mobile project for Window Phone 8 and got a problem.
We’ve got the complex gamebalance data (lots of lists and folded structures) that is created in the Editor and then just loaded on the device.
It works fine for iOS / Android but fails on WP8.
When loading my main resource I’ve got the following:
Exception: Non-negative number required.
Parameter name: capacity
Type: System.ArgumentOutOfRangeException
Module: mscorlib
InnerException: <No Data>
AdditionalInfo:Invoking UnityEngine.IUnitySerializable::Unity_Deserialize method with argument count: 0
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1..ctor(Int32 capacity)
at MY_CLASS_XXXX.Unity_Deserialize()
at MY_CLASS_XXXX.Unity_Deserialize()
at MY_CLASS_XXXX.Unity_Deserialize()
at MY_CLASS_XXXX.Unity_Deserialize()
at MY_CLASS_XXXX.Unity_Deserialize()
at MY_CLASS_XXXX.Unity_Deserialize()
at MY_GAMEBALANCE_MAIN_CLASS.Unity_Deserialize()
at lambda_method(Closure , Object , Object[] , Int32 )
at WinRTBridge.MethodTools.InvokeMethod(Object instance, Int32 methodIndex, Object[] args)
(Filename: Line: 65)
A script behaviour has a different serialization layout when loading. (Read 888 bytes but expected 2643024 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
I’ve replaced my folded classes (which are data containers) with “MY_CLASS_XXXX”.
So, it seems that deserializer reads data resource and when getting to some List.<>, it reads some negative number where the List length is expected (my list can’t be null, I’ve checked it).
So, it seems that serialization format in Unity Editor is uncompatible with device’s Deserializer.
Any thoughts? Writing my own serialize/deserialize methods is extremely hard on the current stage of the product.
PS: And of course, I didn’t use any “#ifdef UNITY_EDITOR” directives in my balance classes.