Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Rednaxela on July 01, 2013, 07:48:07 AM
-
I have couple of UISprites with attached UIAnchor scripts on them (excluding first one, called Background), some kind of hierarchy (Icon -> LBackground -> Background). Each of them has a WidgetContainer object (Icon has LBackground , LBackground has Background). Icon's and LBackground's z-position constantly decreasing if UIAnchor script is active, if i disable it - decreasing stops.
-
Sounds like floating point inaccuracy. Layering UIAnchors in that manner can get a little dodgy.
I recommend you use the fancy new "Run Only Once" if you can, so it doesn't run away like that.
Alternatively, you should change the UIAnchor to not change if the values are less than 1.0f.
-
We had the same problem and I was never able to figure it out before I moved off the project. I think it was causing significant performance problems for us.
-
Yeah, if it is a complex panel, then constantly shifting the position causes the UIPanel to UpdateGeometry every update which is a costly affair. The RunOnlyOnce is a great thing to use in that case.
-
Nicki, I can't use that option. But I have found similar solution - after re-positioning and re-sizing of all needed elements of GUI, I simply destroy all UIAnchor scripts from transform:
UIAnchor[] uiAnchors = transform.GetComponentsInChildren<UIAnchor>();
foreach (UIAnchor uiAnchor in uiAnchors)
Destroy(uiAnchor);
Thanks all for replies.