Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: zippo227 on May 26, 2014, 12:37:03 AM

Title: SetAnchor causes the y component to increase to infinity.
Post by: zippo227 on May 26, 2014, 12:37:03 AM
I'm dynamically creating a label and anchoring it to an object that moves. I'm calling the UILabel.SetAnchor(myObj) function. For some objects, even if the object is standing in idle, assigning the object as the anchor causes the label to move upwards off the screen very quickly.

This didn't happen with my previous version of NGUI. I am on 3.6.0, and this has been happening for the last couple of versions.
Title: Re: SetAnchor causes the y component to increase to infinity.
Post by: zippo227 on May 26, 2014, 08:20:40 PM
I made an interesting class to solve this problem. Message me privately if you are interested in putting the solution into NGUI.
Title: Re: SetAnchor causes the y component to increase to infinity.
Post by: ArenMook on May 26, 2014, 11:51:29 PM
How would I reproduce this on my end?
Title: Re: SetAnchor causes the y component to increase to infinity.
Post by: zippo227 on May 27, 2014, 01:29:20 AM
Essentially, anchor the UILabel to an animating character. That's what did it for me.
Title: Re: SetAnchor causes the y component to increase to infinity.
Post by: directedchaos on January 21, 2015, 03:04:45 AM
I just ran into this too, with a UISprite anchored in code to another UISprite's background whose size changes.  However, even when the size of the target doesn't change, it keeps shooting the transform's y to infinity.
Title: Re: SetAnchor causes the y component to increase to infinity.
Post by: ArenMook on January 22, 2015, 11:05:42 AM
I can see this happening if you create a circular anchor: something anchored to a parent object that includes the child in its bounds, so basically something that effectively gets anchored to itself. I'll need an actual step by step guide or a repro case to examine this further as "anchor a label to an animating character" doesn't give me anything.
Title: Re: SetAnchor causes the y component to increase to infinity.
Post by: zippo227 on January 28, 2015, 01:13:21 AM
I fixed the problem with an interesting workaround, so I don't have anything to send you. I'm sure you are right in that it is some kind of circular dependency. Hopefully the other commenter has a fresh project that can be sent to you!