- Home /
Why RecTransform.rect.center.Set isn't working?
Is this a bug? You can easily replicate this by:
1- Creating a GameObject
2- Giving it a RectTransform in Inspector (Layout component)
3- Attributing to it a new Script,
4- and then you use this in the script (Awake, Start etc. method):
GetComponent ().rect.center.Set (0f, 10f); //0, 10 for instance. It could be any value.
And then in Update(), you do:
Debug.Log(GetComponent ().rect.center);
It'll always print it's initial value (0,0). Why center.Set won't work????
Thanks.
Comment
i think you cant change that variable ... look at this : http://docs.unity3d.com/ScriptReference/RectTransform.html think thats not necceserie to change.