Search Issue Tracker

By Design

Votes

0

Found in

2020.1.6f1

2020.1.9f1

2020.2.0b7

Issue ID

1281325

Regression

No

.unity-button 'font-size' in 'default.uss' cannot be overriden in custom USS

UI Toolkit

-

Reproduction steps:
1. Open attached project "Multile Style Sheets.zip"
2. Open "SampleScene" scene
3. Enter Play Mode
4. Notice the font size of the buttons
5. Change "font-size" to 100px in "Custom.uss"
6. Enter Play Mode

Expected result: The font size is changed
Actual result: The font size is not changed

Reproducible with - 2020.1.9f1(1.0.0-preview.9), 2020.2.0b7(1.0.0-preview.9)
Could not test with - 2019.4 (Package introduced in 2020.1), 2021.1.0a2 (Editor errors)

  1. Resolution Note:

    The issue is that the Custom.uss file contains an invalid property, e.g. "-unity-font-size". That property has been removed a few versions back.
    When re-importing the USS file, a warning to that effect should be displayed in the console.

    Currently an invalid property such as this one will cause the rule to become "invalid", so no properties after it will apply.

    Removing the "-unity-font-size" property will make "font-size" take its effect.

    For users who need to support older versions with their USS files, moving them at the end of the rule should work around that behaviour.

Comments (1)

  1. MoruganKodi

    Oct 28, 2020 06:57

    Uh no. The issue is that we cannot override the default font size in any way whatsoever.

    weather it be `font-size` used, or `-unity-font-size`, it makes no difference. The font in default-uss refuses to be overridden.

    How do we remove that property from a pregenerated (and non-editable) uss file which does not exist in CSS form? Unity supplies Default.Uss as an asset and not a file in a human readable CSS form - so we are still stuck with this issue because we cannot remove that rule from the default ourselves.

    Unity does not give us a variant of `default.uss` in a human readable form, your asset is a text asset of pre-serialized data.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.