Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: bdominguez on May 12, 2014, 06:54:24 AM

Title: AnchorUpdate OnEnable and Unity Editor
Post by: bdominguez on May 12, 2014, 06:54:24 AM
Why you always use "OnUpdate" behaviour in Unity Editor despite of setting "OnEnable"?

UIRect.cs line 410 ( NGUI 3.5.8 )

Quote
#if !UNITY_EDITOR
         if (updateAnchors == AnchorUpdate.OnUpdate || mUpdateAnchors)
#endif

It's really confussing and I can't test anything correctly in editor.

Example:

- You set a Widget to "OnEnable" because later you want to move it.
Title: Re: AnchorUpdate OnEnable and Unity Editor
Post by: ArenMook on May 12, 2014, 04:43:03 PM
Hmm? That if statement is "if not UnityEditor". Update Anchors should only be executed if the condition is set to "OnUpdate", and not "OnEnable". It behaves differently in the editor because changes must be reflected while you are not playing the game. Although it's probably best if that statement reads:
  1. #if UNITY_EDITOR
  2.                         if (updateAnchors == AnchorUpdate.OnUpdate || mUpdateAnchors || !Application.isPlaying)
  3. #else
  4.                         if (updateAnchors == AnchorUpdate.OnUpdate || mUpdateAnchors)
  5. #endif
Title: Re: AnchorUpdate OnEnable and Unity Editor
Post by: bdominguez on May 13, 2014, 01:08:03 AM
Hmm? That if statement is "if not UnityEditor". Update Anchors should only be executed if the condition is set to "OnUpdate", and not "OnEnable". It behaves differently in the editor because changes must be reflected while you are not playing the game. Although it's probably best if that statement reads:
  1. #if UNITY_EDITOR
  2.                         if (updateAnchors == AnchorUpdate.OnUpdate || mUpdateAnchors || !Application.isPlaying)
  3. #else
  4.                         if (updateAnchors == AnchorUpdate.OnUpdate || mUpdateAnchors)
  5. #endif

That's my problem.

So are you going to change that in next version? Thanks!
Title: Re: AnchorUpdate OnEnable and Unity Editor
Post by: ArenMook on May 13, 2014, 08:43:36 AM
Yup, already done.