Search Unity

Changing a canvas' width & height

Discussion in 'UGUI & TextMesh Pro' started by Section-One, Mar 11, 2015.

  1. Section-One

    Section-One

    Joined:
    Sep 8, 2014
    Posts:
    81
    Hi,

    I have a canvas in render mode "worldspace"

    How can i change via script the width & height?
    Same goes for "Panel" element.

    Thanks
     
  2. Ramcat

    Ramcat

    Joined:
    Aug 16, 2014
    Posts:
    95
    There does not seem to be a "Panel" object provided by Unity. So that becomes a much more complicated problem. As for Canvas I suggest local scale with all it's inherent problems. An alternate way might be to get the rectTransform via GetComponent and call the sizeDelta method.
     
  3. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689