public void OnButtonSelect(int i){
//add a TweenPosition component to the panel (buttonPanel, assigned in inspector)
//if it doesn't already have one...
TweenPosition tp = buttonPanel.GetComponent<TweenPosition>();
if( tp == null){
tp = buttonPanel.gameObject.AddComponent<TweenPosition>();
}
Vector3 scrollFactor
= new Vector3
(-10
.0f,
0,
0); tp.from = buttonPanel.transform.position;
tp.to = tp.from + scrollFactor;
tp.eventReceiver = this.gameObject;
tp.callWhenFinished = "OnPanelScrollDone";
tp.method = UITweener.Method.EaseInOut;
tp.duration = 1.5f;
tp.Play(true);
}
public void OnPanelScrollDone(int i){
TweenPosition tp = buttonPanel.GetComponent<TweenPosition>();
Destroy(tp);
}