Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: FizzPow on December 07, 2012, 08:42:42 PM
-
Running into an issue I hope I can get a better solution for.
I am trying to lay out my screen using anchors for everything so my UI looks correct on many different aspect ratios. That is all working great. The problem is, now I want to do some Tween animations to bring the objects on screen in various ways to build the screen.
I am trying to use HOTween.From() with a relative #, so that it ends up where it is already. The problem is two-fold:
1) If I call this on Start(), the object is not at the correct anchor'd coordinates yet, so it ends up animating the wrong way
2) When the animation is done, the anchor snaps it back to where it should be
The solution I found that seems very in-elegant is to:
- Set the object's anchor in editor to have a high depth offset so its not visible
- In Start() Call Invoke() with a 0.1f delay so the anchor has time to set
Then In Invoked function
- Disable the objects anchor
- Set its Z back to 0 so its visible
- Then call my HOTween.From() method to animate it in
This works but is a ridiculous amount of steps. Please tell me there is a better way? Thanks!! ;D
-
If an object has an anchor, it should not be animated. Animate its child instead.
-
Doh! Yes, I just had to create a parent anchor gameobject and then tween the child, this works great, thanks =)