How to modify RectTransform properties in script [Unity 4.6 beta]

后端 未结 7 937
面向向阳花
面向向阳花 2020-12-24 15:03

\"enter

Hello, I\'m using the new UI system from Unity 4.6 beta...

Tried diffe

7条回答
  •  情书的邮戳
    2020-12-24 15:44

    GetComponent().anchoredPosition3D; It should work fine x , y , z are PosX , PosY and PosZ of recttransform you can use Vector3 to store the value

    Vector3 values = new Vector3();
    public GameObject rect_obj;
    //Use this if script is on that recttransform component
    values = this.transform.GetComponent().anchoredPosition3D;
     //else           
    values = rect_obj.transform.GetComponent().anchoredPosition3D;
            
    

提交回复
热议问题