Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Weird error message

Discussion in 'Windows' started by bakno, Aug 22, 2013.

  1. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    595
    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?
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,693
    Hmph, try cleaning the folder, before building, and see if that helps
     
  3. moyesjack

    moyesjack

    Joined:
    Aug 22, 2013
    Posts:
    11
    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. :)
     
  4. Nidre

    Nidre

    Joined:
    Dec 12, 2012
    Posts:
    22
    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?"
     
  5. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    595
    Cleaning the folder before building solved the problem. Thanks Tomas.