Playmaker Forum

Archived Boards => Windows Phone 8 Help => Topic started by: ashwini on September 02, 2014, 01:31:44 PM

Title: Serialization/De-serialization issue of FsmVar on window Phone 8
Post by: ashwini on September 02, 2014, 01:31:44 PM
Playmaker dll used: Windows Add-on
Unity Version: 4.5.3

Issue:
The serialization/deserialization of the FsmVar object fails on windows-phone(the same works on unity-editor & Android-phone).
Same playmaker.dll works for Android & Unity-Editor but fails for windows target.

With the help of our the simple recreate[attached], we identified that the problem is happening due to ‘mismatch in HashCodes  values returned(for a string) by Monodevelop(used for serialization of scenes etc. by unity compiler) and by windows-supportive-playmaker dll while de-serializing the scenes etc’.
 
So, when Unity compiler serialize a scene(while building for a target), it uses  Hashcode values returned by Monodevelop string.GetHashCode(). Now while running the target build in window phone, the playmaker dll (before populating FsMVar Fields)compares the stored Hashcode with the hashcode returned by ‘ActionData.GetActionTypeHashCode (actionType)’ API. Since the value returned by ‘ActionData.GetActionTypeHashCode (actionType))’ is different than the one that was used for serialization by Unity, the Hashcode match fails, and hence it doesn’t deserialize the field correctly( and make it Float by default), and hence loading of Scenes fails.
 
The playmaker does this de-serialization in ‘CreateAction’ method of ‘HutongGames.PlayMaker.ActionData’ Class, in the following lines:
 
CodeSnippet: ( from CreateAction’ method of ‘HutongGames.PlayMaker.ActionData)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>               int num = this.actionHashCodes [actionIndex];     -----Gets the hash-code value used by Unity Compiled.
               if (num == ActionData.GetActionTypeHashCode (actionType))  -----Compare the above hash-code value with the one returned by ‘GetActionTypeHashCode’ for that actionType.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
For example: for  "System.StringHutongGames.PlayMaker.FsmVarSystem.Boolean".GetHashCode();
Monodevelop returns:  -951609300
While Visual Studio(using Playmaker.dll) returns:  -1941977249
 
Hence, it is clearly identified as playmaker issue.

Hi Playmaker team, could you please look into this at the earliest?
Title: Re: Serialization/De-serialization issue of FsmVar on window Phone 8
Post by: Alex Chouls on September 04, 2014, 11:50:30 AM
Hi, we found this issue in the latest beta. We changed to a custom hash function that behaves the same on every platform.

I sent you an invite to the beta. Beta 15 has some problems on WP8. Beta 14 should work, but doesn't pass certification yet. Replace b15 with b14 in the download link to get the older version to test... Beta 16 should be out soon...
Title: Re: Serialization/De-serialization issue of FsmVar on window Phone 8
Post by: ashwini on September 05, 2014, 03:57:47 AM
Could you please provide the ETA for Beta 16?
Meanwhile we can try with Beta 14(but seems from your comment, that it the issue is NOT fixed in Beta 15 & Beta 14).
Title: Re: Serialization/De-serialization issue of FsmVar on window Phone 8
Post by: ashwini on September 05, 2014, 08:16:56 AM
We tried with the Beta-14 version. Getting the following exception -

Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

which shows the playmaker.dll does not support windows phone.
Title: Re: Serialization/De-serialization issue of FsmVar on window Phone 8
Post by: Alex Chouls on September 05, 2014, 07:50:52 PM
Did you import the wp8 beta?
Title: Re: Serialization/De-serialization issue of FsmVar on window Phone 8
Post by: ashwini on September 07, 2014, 08:32:58 AM
To add context here:
Received Beta v1.8 Playmaker dlls from Alex(through mail) for testing.

Test Result:
Got below mentioned error while importing the WP8-Playmaker plugin.
I tested it twice.Got the same result.

Exception, while importing it:
--
Assets/External/PlayMaker/Editor/FsmComponentInspector.cs(332,36): error CS1501: No overload for method `GetFsmVariableList' takes `2' arguments
--

Due to this, I was not able to import it. Even I tried on different version of Unity(4.5.3final) there too I received the same issue.

Informed Alex about it.