How to set the anchoredPosition of a RectTransform via script in Unity3D -


i trying set anchoredposition of ui image instance programmatically. have tried these ways:

getcomponent<recttransform>().anchoredposition=new vector2(0,0); 

and

getcomponent<recttransform>().anchoredposition.set(0,0); 

but none of above seem work. infact when run program, in inspector says anchoredposition (0.5,0.5). , puts image likes. that?


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -