The first time I built an UWP rendition of my game I was plagued with different serialization layout errors:
A script behaviour (probably [My component]?) has a different serialization layout when loading.
This error seemed to appear for each of my custom components.
At first I did exactly as the error messages suggested: I removed all #ifdef statements my code. While doing so, I realized none of them encapsulated any public fields of any of my game components (classes descended from Unity3D's MonoBehavior class), so obviously precompiler directives were not the issue.
I then did some googling and found a site that claimed Unity3D sometimes serialized all fields, so I added the [NotSerialized] attribute to my protected and private fields. I even changed my getters and setters into methods; again no luck.
Then I decided to focus on the Unity3D project. I viewed my plugins in the Inspector and noticed that the “Do not process checkbox” was checked for each. Based on the article here (https://docs.unity3d.com/Manual/windowsstore-plugins.html), which clearly states that Unity injects serialization code into plugins, I unchecked the check boxes for each of my plugins.
And voila! That resolved my issue!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment