Hey ,guys
I am confused with Unified Anchors serval days already.
There is a gameobject, it's a panel. And I want move it from left to right(like ios slide effect);
The gameobject attached UIWidget with Unified anchors.
The problem is that the position of the panel(gameobject) will reset to the old postion(0,0,0) after the tween completed;
So I have a idea to fix it. after tween set widget's anchors to None;
But is this the correct way?
My code like below:
Hashtable compelteParams = new Hashtable();
compelteParams.Add("currentPage",currentPage);
compelteParams.Add("nextPage", nextPage);
iTween.MoveTo(currentPage.gameObject, iTween.Hash("x", Screen.width, "time", 0.6, "islocal", true, "oncomplete", "onSwitchComplte", "onCompleteTarget", gameObject, "oncompleteparams", compelteParams));
public void onSwitchComplte(Hashtable obj)
{
Page currentPage = obj["currentPage"] as Page;
//Page nextPage = obj["nextPage"] as Page;
//currentPage.gameObject.active = false;
UIWidget widget = currentPage.GetComponent<UIWidget>();
widget.leftAnchor.target = null;
widget.rightAnchor.target = null;
widget.topAnchor.target = null;
widget.bottomAnchor.target = null;
Debug.Log("onSwitchComplte ");
}
the same result with this code:
TweenPosition tweenpos =TweenPosition.Begin(currentPage.gameObject, 0.4f, new Vector3(Screen.width, 0, 0));
NGUI version is latest:3.4.9