Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

How to translate RectTransform to Transform

$
0
0
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.

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>