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
  4. Dismiss Notice

Question Modifying UI Element Properties in Script

Discussion in 'UI Toolkit' started by Drakkith, Sep 18, 2022.

  1. Drakkith

    Drakkith

    Joined:
    Nov 29, 2016
    Posts:
    57
    Hey all.
    How do you set various UI element properties in a c sharp script?
    For example, how do you change the flex direction of a visual element after creating it?
    Thanks in advance.
     
  2. pierre_10

    pierre_10

    Unity Technologies

    Joined:
    Apr 1, 2016
    Posts:
    33
  3. Drakkith

    Drakkith

    Joined:
    Nov 29, 2016
    Posts:
    57
    Thanks. I can find elements, and discovered that you can use .layout or .style to change certain things, which answers my question mostly I think. Do you know if all the properties are available to change via code? Such as the flex direction? Either it isn't changeable via code or I just don't know the exact syntax or whatever to change it.
     
  4. pierre_10

    pierre_10

    Unity Technologies

    Joined:
    Apr 1, 2016
    Posts:
    33
    the best advice i can give you is take a look at the docs for specifics. They are also a few tutorials on youtube to hel you out.