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

How to set '-unity-font-definition' to 'None' in uss file?

Discussion in 'UI Toolkit' started by momiji_jin, Apr 29, 2022.

  1. momiji_jin

    momiji_jin

    Joined:
    Feb 25, 2020
    Posts:
    5
    Hi, I am trying to use UIE in my new project. I like to dynamically generate UI controls from configuration data + c# code. Font and Font Asset in Text interfered with my work when I inherited Button and encapsulated it as a new base control, Font Asset will be assigned an initial Asset, which will cause Font assignments to fail.
    upload_2022-4-29_14-7-18.png
    But assigning '-unity-font-definition' in USS causes an new exception (I've tried the string None, assigning it directly to None or null, neither of which prevents an exception from being raised)
    upload_2022-4-29_14-14-26.png
    upload_2022-4-29_14-15-2.png
    That's all I could find https://docs.unity3d.com/Manual/UIE-USS-SupportedProperties.html
    upload_2022-4-29_14-16-45.png
    What do I need to do to properly assign this property to None like the document at runtime ?
    Thank you all
     
  2. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    529
    This exception seems related to a live reload bug that we fixed recently. The workaround is to use a second UI document using the same PanelSettings in your scene.
     
  3. momiji_jin

    momiji_jin

    Joined:
    Feb 25, 2020
    Posts:
    5
    thank you for your help!
     
  4. seyfe

    seyfe

    Joined:
    May 10, 2019
    Posts:
    74
    @SimonDufour Maybe I missed something, but how do you actually set the USS property to "None" (as mentioned in the docs) from the USS style file?