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

Resolved Changing background-color of TextField

Discussion in 'UI Toolkit' started by Xan_9, Nov 23, 2021.

  1. Xan_9

    Xan_9

    Joined:
    Oct 7, 2020
    Posts:
    31
    gareth_untether likes this.
  2. Xan_9

    Xan_9

    Joined:
    Oct 7, 2020
    Posts:
    31
    Solved it by using AddToClassList() and adding/removing a selector every time I want to change the color.
     
    gareth_untether likes this.
  3. prattmyster

    prattmyster

    Joined:
    Apr 15, 2015
    Posts:
    17
    Hi i am currently stuck on this, I am adding a textfield through code, is it the actual textfield that i need to clear the style sheet from or is it a child element that i need to add a styleSheet to.