Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ammarz

Pages: [1]
1
NGUI 3 Support / Re: Unity 4.5.5p3 Weirdness
« on: November 07, 2014, 05:24:06 PM »
That's not exactly a fix. Invoke() doesn't work at edit time. You are basically removing the OnValidate call altogether in edit time.

lol good to know, well here's another dirty workaround, I don't know exactly why it works, but still enables me to quickly edit and test the UI without affecting game code itself.

also in UIRect:
  1. protected virtual void OnValidate()
  2. {
  3.         if (NGUITools.GetActive(this))
  4.         {
  5.                 if (!Application.isPlaying) ResetAnchors();
  6.                 Invalidate(true);
  7.  
  8.                 // the workaround
  9.                 if (mCam == null){
  10.                         mAnchorsCached = false;
  11.                 }
  12.         }
  13. }

2
NGUI 3 Support / Re: Unity 4.5.5p3 Weirdness
« on: November 07, 2014, 04:35:34 PM »
well here's a quick and dirty fix I did and it worked ...

In UIRect I changed this:
  1. protected virtual void OnValidate()
  2. {
  3.         if (NGUITools.GetActive(this))
  4.         {
  5.                 if (!Application.isPlaying) ResetAnchors();
  6.                 Invalidate(true);
  7.         }
  8. }

to this:
  1. protected virtual void OnValidate()
  2. {
  3.         Invoke("delayedOnValidate", 0.0001f);
  4. }
  5. private void delayedOnValidate ()
  6. {
  7.         if (NGUITools.GetActive(this))
  8.         {
  9.                 if (!Application.isPlaying) ResetAnchors();
  10.                 Invalidate(true);
  11.         }
  12. }

I didn't test it that much, but seems to do the trick for now, at least in my case.

3
NGUI 3 Support / Re: Unity 4.5.5p3 Weirdness
« on: November 07, 2014, 03:26:09 PM »
Looked into this. It seems what Unity broke is that before, the call order was:

Awake
OnEnable
OnValidate

Now it's

OnValidate
Awake
OnEnable

Ahaa I knew it had something to do with event call orders, but been busy updating other stuff in my game, now that you confirmed it I think I can come up with a quick fix.

4
NGUI 3 Support / Re: Unity 4.5.5p3 Weirdness
« on: November 07, 2014, 02:51:26 PM »
I think this related to the issue discussed in this post, also it happens with the recent 4.5.5p4.
Unity probably changed a behavior of some sort which broke anchoring inside the editor, I tried investigating and made some dirty fixes, but its still not behaving normally as it should, it seems its caused by mCam in UIPanel being null when worldCorners geter is called but didn't have the time to dive deeper into the code hoping it'll be fixed by either Unity or Aren soon.

A quick workaround is to edit anything in the code to trigger a recompile which gets everything into position, but hitting the play button messes it again ...

Pages: [1]