Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to chnage the Scale propery of rect tranform unity

// To Change the "Scale" property use localScale, like this
// Change the numbers in the "()" to your choosen scale
public GameObject YourPanel;
YourPanel.GetComponent<RectTransform>().localScale = new Vector3(newWidthUI, newHeightUI, 1);

// If you want to change it in pixels
public GameObject yourUI;
yourUI.GetComponent<RectTransform>().sizeDelta = new Vector2(newWidthUI,newHeightUI);
 
PREVIOUS NEXT
Tagged: #chnage #Scale #propery #rect #tranform #unity
ADD COMMENT
Topic
Name
1+6 =