Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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!