1
NGUI 3 Support / Re: Menu enter from left
« on: April 09, 2015, 06:03:21 PM »
Hi! thank you for your answer. I have solved using TweenPosition but I have another problem....
The menu is on the left out of the screen and it is anchored to UIRoot. It enter from left using TweenPosition using this code attached to it
All work fine but if I want to reset the sprite to the original position and also reset TweenPosition as if I had never used it, how can I do ? I have tried to use this code
but not work fine on device
when the menu go back it not coming out the screen to the initial position but instead it work fine on Unity Player....why ?
This is the problem
The menu is on the left out of the screen and it is anchored to UIRoot. It enter from left using TweenPosition using this code attached to it
- void Awake () {
- tw = gameObject.GetComponent<TweenPosition>();
- uiTweener = tw.GetComponent<UITweener>();
- originalPosition = transform.localPosition;
- TweenPosition.Begin(gameObject,1f,originalPosition);
- //Take the x position from another object on the screen
- tw.to.x = liveObj.transform.localPosition.x;
- }
- private void playTw(){
- if(transform.localPosition.x == tw.from.x){
- uiTweener.PlayForward();
- setStateBonus(true);
- }else{
- uiTweener.PlayReverse();
- setStateBonus(false);
- }
- GetComponent<UISprite>().ResetAndUpdateAnchors();
- }
All work fine but if I want to reset the sprite to the original position and also reset TweenPosition as if I had never used it, how can I do ? I have tried to use this code
- TweenPosition.Begin(gameObject,1f,originalPosition);
- uiTweener.ResetToBeginning();
- GetComponent<UISprite>().ResetAndUpdateAnchors();
- NGUITools.SetActive(gameObject,false);
- tw.enabled = true;
- setStateBonus(false);
but not work fine on device

This is the problem