Author Topic: Serialization warning  (Read 9431 times)

athos

  • Guest
Serialization warning
« on: November 30, 2012, 05:51:08 PM »
I get the following on startup:

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

I believe I've tracked it down to UIPanel.cs:

#if UNITY_EDITOR
   // Screen size, saved for gizmos, since Screen.width and Screen.height returns the Scene view's dimensions in OnDrawGizmos.
   Vector2 mScreenSize = Vector2.one;
#endif

Is the #if necessary or can a NonSerialized attribute be added?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Serialization warning
« Reply #1 on: December 01, 2012, 07:28:23 AM »
That doesn't make sense. The mScreenSize shouldn't be serialized from what I can see.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Serialization warning
« Reply #2 on: December 01, 2012, 11:35:41 AM »
Private fields don't get serialized, yeah. What version of NGUI / Unity?

athos

  • Guest
Re: Serialization warning
« Reply #3 on: December 01, 2012, 07:06:19 PM »
Nicki, you're quite right. I just confirmed the issue was in fact coming from a different project file. Thanks for pointing that out.

Anxo

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Serialization warning
« Reply #4 on: January 14, 2015, 05:57:54 PM »
Nicki, you're quite right. I just confirmed the issue was in fact coming from a different project file. Thanks for pointing that out.

Hi Sorry, I have no intention of highjacking NGUI fourm but this I now have this problem and can not find the solution. @athos What did you track this issue down to?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Serialization warning
« Reply #5 on: January 14, 2015, 10:11:31 PM »
You need to start a new thread and better explain your issue, Anxo. This thread is from 2012.