16
NGUI 3 Support / Re: Tween animation with the stetching and anchoring issue.
« on: April 23, 2014, 08:28:51 AM »
Hi
My prefab architecture is like below.
MainMenu (Empty Gameobject) having page script(CMainMenu.cs) which will execute when this prefab comes in memory.
Child Container (empty gameobject)
Sprite (background image) attached a custom unifiied anchor scrip to stretch & anchor using UIRoot.
UIButton 1 - anchored (left top) using custom script using UIRoot.
UIButton 2 - anchored (center)using custom script using UIRoot.
UIButton 3 - anchored (right bottom)using custom script using UIRoot.
Now my page is done.
Now i want from this page to come on screen with tween animation say left to right etc. For that what i did ,when MainMenu prefab instantiated CMainMenu.cs executed . its Start() i added a this.gameObject.AddComponent<TweenPosition>(); on runtime.
provided some tween from to "to" position and added some onFinished event , but before that i just disable my anchor script from Sprite (background image) similarly from button also and after the animation i just enabled it. Other wise tween animation wont happen.
Now page animation is done but with some dirty jerk. moment i remove my unified anchor script it resized , got animation because of tween and at the end again comes to original size because i enabled the anchor script. Which is not looking very smooth.
Can't we tween the base container MainMenu without affecting any of the child element having unified anchor or custom anchor?
i am creating a generic tool where we specify the page transition with animation type , it will take care of every thing else.
I have created to custom script for Unified Anchoring & Custom Anchor , which uses the UiRoot (Fixed to 720) reference at runtime , according to that my background got stretched , button got anchored etc.
My prefab architecture is like below.
MainMenu (Empty Gameobject) having page script(CMainMenu.cs) which will execute when this prefab comes in memory.
Child Container (empty gameobject)
Sprite (background image) attached a custom unifiied anchor scrip to stretch & anchor using UIRoot.
UIButton 1 - anchored (left top) using custom script using UIRoot.
UIButton 2 - anchored (center)using custom script using UIRoot.
UIButton 3 - anchored (right bottom)using custom script using UIRoot.
Now my page is done.
Now i want from this page to come on screen with tween animation say left to right etc. For that what i did ,when MainMenu prefab instantiated CMainMenu.cs executed . its Start() i added a this.gameObject.AddComponent<TweenPosition>(); on runtime.
provided some tween from to "to" position and added some onFinished event , but before that i just disable my anchor script from Sprite (background image) similarly from button also and after the animation i just enabled it. Other wise tween animation wont happen.
Now page animation is done but with some dirty jerk. moment i remove my unified anchor script it resized , got animation because of tween and at the end again comes to original size because i enabled the anchor script. Which is not looking very smooth.
Can't we tween the base container MainMenu without affecting any of the child element having unified anchor or custom anchor?
i am creating a generic tool where we specify the page transition with animation type , it will take care of every thing else.
I have created to custom script for Unified Anchoring & Custom Anchor , which uses the UiRoot (Fixed to 720) reference at runtime , according to that my background got stretched , button got anchored etc.