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?