I am using iTween to move and ease my UI, but I cannot find a way to translate the RectTransform's position to a transform.position.
Here's my example script:
#pragma strict
private var rt : RectTransform;
var uiButton : UI.Button;
var vector3 : Vector3;
function Start ()
{
rt = uiButton.GetComponent(typeof (RectTransform)) as RectTransform;
}
function Update ()
{
if(Input.GetKeyDown(KeyCode.Space))
{
iTween.MoveAdd(uiButton.gameObject, iTween.Hash("y", vector3.y, "time", 2, "easeType", iTween.EaseType.easeInOutQuad));
}
}
I set the vector3 variable as 100 and it goes to the world space 100, not the recttransform 100.
↧