Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question No match for USS class while other class does work

Discussion in 'UI Toolkit' started by SkywardRoy, Oct 24, 2021.

  1. SkywardRoy

    SkywardRoy

    Joined:
    Jan 14, 2017
    Posts:
    22
    I have a button with an image and a label as child elements. And I am using the following USS:
    Code (CSharp):
    1. image {
    2.     min-width: 400px;
    3.     padding-right: 600px;
    4. }
    5.  
    6. image--thumbnail {
    7.     width: 80px;
    8.     height: 80px;
    9. }
    10.  
    11. .button {
    12.     border-color: grey;
    13.     background-color: rgba(149, 149, 149, 0.5);
    14.     margin-bottom: 5px;
    15.     border-radius: 3px;
    16.     border-width: 3px;
    17.     font-size: 24px;
    18.     -unity-text-align: middle-center;
    19.     color: black;
    20.     -unity-font: url('project://database/Assets/Fonts/FiraCode/FiraCode-Retina.ttf?fileID=12800000&guid=8377f75cf15bf439fa06cc8c998c56f2&type=3#FiraCode-Retina');
    21. }
    I've had the button class for a little while and added the image class today. Somehow no matter what class I add to my USS file it doesn't get matched on my UI elements. I've tried applying the button class to some element with the UI debugger and it is immediately recognized. But when I try any new class (including image) nothing happens even though I see image in the class list and both classes are in the same USS file.

    I even restarted Unity and moved the USS file around. Do you have any idea what might be going wrong?
     
  2. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    471
    It seems you are missing a dot before the name of your class. Try with
    Code (CSharp):
    1. .image
    or
    Code (CSharp):
    1. .image-thumbnail
    .
     
  3. SkywardRoy

    SkywardRoy

    Joined:
    Jan 14, 2017
    Posts:
    22
    Oh! That is so dumb! Thank you!

    I stared for hours at this yesterday and even typed different classes to see if they would work. Guess I was a little too tired