Answers for "how to change the width of a panel unity"

C#
0

how to change the width of a panel 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);
Posted by: Guest on November-06-2020

Code answers related to "how to change the width of a panel unity"

C# Answers by Framework

Browse Popular Code Answers by Language