Search Unity

appoint uss in uxml

Discussion in 'UI Toolkit' started by wang37921, Nov 1, 2019.

  1. wang37921

    wang37921

    Joined:
    Aug 1, 2014
    Posts:
    102
    Could I appoint USS in UXML file? or create a USS snippet in UXML file directly?
    Now, I just know one method:
    create a uss file, manual load the uss file, load uxml file and instantiate it, add the loaded uss into VisualElement's styleSheets.
    It's very boring...
     
  2. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    https://forum.unity.com/threads/specifying-styles-uss-in-uxml-file.677917/#post-4539229

    Code (csharp):
    1. <VisualElement style="border-width: 20px; border-color: rgb(255,0,0);"/>
     
  3. wang37921

    wang37921

    Joined:
    Aug 1, 2014
    Posts:
    102