Search Unity

Question UI

Discussion in 'UGUI & TextMesh Pro' started by Blitz204, Sep 28, 2022.

  1. Blitz204

    Blitz204

    Joined:
    Dec 24, 2020
    Posts:
    48
    Is it possible to change the transform (position) of a piece of UI in the canvas from the script?
     
  2. crjase

    crjase

    Joined:
    Feb 13, 2022
    Posts:
    6
    yeah. In your code, add a public variable, drag your UI element into it unless you're referencing it with a tag or something. Then you can do something like variable.transform.position to get and change the position.
     
  3. Blitz204

    Blitz204

    Joined:
    Dec 24, 2020
    Posts:
    48
    Thanks!