Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Capyvara on August 19, 2014, 05:01:57 PM
-
Hello,
I've updated to 3.7.0 from 3.6.5 and I noticed a bug that I couldn't pinpoint the origin, I have a UIDistribute component that basically sets the anchors to uniformly distribute the children in a container, but after the update in some cases the UILabel contents (set to ShrinkContent) was leaking outside the rect area.
(http://i.imgur.com/raqCozR.png)
I managed to isolate the problem in a isolated environment, the .unitypackage is attached, just import into NGUI project, open the scene and click the button a couple times.
Seems that UILabel didn't detect the size change and shouldBeProcessed isn't being set.
Am I doing something wrong? There's a better way to do that?
-
Interesting... I looked into this. You enable the game objects, then you do your repositioning logic. The first time you do it, OnEnable doesn't do much because the widget's Start() hasn't been executed yet. The second time it has been, so it runs through the validation code and does the label text processing. Problem is, since this happens in OnEnable, it's done before your repositioning code runs.
Change your code to not ignore disabled objects, and it works fine. Comment out "OnValidate()" call in UIRect.OnEnable, and it also works fine. I'll do the 2nd on my end and see what side effects I get from this.
-
Well, I need to ignore the disabled objects, it's one of the main purposes of this component, to make the enabled game objects fill up the entire area :)
So this is a editor only problem, interesting.