Search Issue Tracker

Won't Fix



Found in




Issue ID




CustomStyleProperty can't be retrieved when its value is set in pixels



Reproduction steps:
1. Open the attached “BugRepro” project
2. Open the “Assets/UXMLTest” Visual Tree Asset using UI Builder window
3. Observe the Console

Expected result: No warnings are logged
Actual result: “Trying to read custom property --custom-line-width value as Float while parsed type is Dimension” warning is logged

Reproducible with: 2021.3.38f1, 2022.3.30f1, 6000.0.3f1

Reproducible on: Windows 11
Not reproducible on: No other environment tested

  1. Resolution Note:

    Customs styles are currently not supporting all possible units and it is not a priority to support more type of data for custom styles.

    From the use case, it seems like the value are always going to be in pixels so a float seem appropriate for this. Otherwise, I would recommend using a string and do your own parsing for better error management.

Comments (2)

  1. SimonDufour

    May 23, 2024 17:47

    The current handling of custom style is far from ideal. One of the problem we have is that we rely on the validation string to do a lot of check on the input uxml/uss but we don't have any error handling if we don't have this validation string. The error would be silent and behavior, a random exception at runtime or at import time. The result of a badly formed data would be unpredictable, and not easy to diagnose.

    In order to properly expose more custom style type, we would have to review a lot of the code that was build with the assumption of the validator.

    This is something I personally want to expose, but it does block any workflow and we cannot introduce new features to unity 6, no matter how small they are. Even if someone add something in the next version of unity, there will be a gap before you can use it.

    We are closing the bug as to be better at informing users of the things that won't happen in a predictable future.

    You can suggest an entry in the roadmap at , and get people to vote on it. It helps focus the attention of our product owner on your wishes and need.

    Thanks for your feedback! It did trigger a lot of internal discussions, even between multiples teams, that did trigger the actual reflection on where to start with the feature.

  2. XenoPhoenix

    May 22, 2024 15:07

    While I understand the priority, it's disappointing that a float is considered a workable fallback, as a value of "1.0" does not give the same as "1px" retrieved from another property, meaning using lines widths from custom properties and normal properties are not consistent.

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.