Weird error message

We are porting our first game to Win8 and now we are facing the Javascript problem. We decided to convert our first javascript to C# (the shortest one) which runs fine in Unity but when debugging from VS, it shows the following error message in the development console:

"A script behavior has a different serialization layout when loading. (Read 24 bytes but expected 176 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any scripts?"

The problem is generated by a public variable that is declared as a Material[ ]. And even when a single Material is used the same problem happens.

If this variable is declared as private or static, the error does not happen. But we need it to be public in order to be able to assign the material in the inspector.

Any thoughts?

Hmph, try cleaning the folder, before building, and see if that helps

Nop. I heard this first time I think, Will let you know surely if I will found something related to this. Actually Im doing research and visit some popular website and forums to gain information as well solve the problems like this. :slight_smile:

I am having the exact same issue.It only happens on WP8 build for me. That would be great if you find any solutions to this i am not sure if its actually affecting anything important tho.

“A script behavior has a different serialization layout when loading. (Read 24 bytes but expected 176 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any scripts?”

Cleaning the folder before building solved the problem. Thanks Tomas.