Search Unity

Feature Request Nested properties in USS

Discussion in 'UI Toolkit' started by Kirsche, Jul 20, 2020.

  1. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    121
    _geo__, ontrigger, tonytopper and 3 others like this.
  2. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    792
    I prefer SASS (CSS variant) but the way the nesting works is the same as with LESS.

    You could probably use these preprocessors.

    However, nesting can quickly become confusing if you overdo it.
    I have already seen projects where 6-7 and more levels have been nested :confused:.
     
    Kirsche likes this.
  3. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    I have to second this, it'd be so useful for readability and maintainability!
     
    tonytopper likes this.
  4. uMathieu

    uMathieu

    Unity Technologies

    Joined:
    Jun 6, 2017
    Posts:
    398
    We have seen teams using SASS to generate uss. Maybe you can try to setup an AssetImporter to invoke your favorite preprocessor to generate your uss files.
     
  5. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    Interesting! I'd much rather not having to use another external tool, but that's a cool idea. I'm going to look into this. Cheers!
     
    ontrigger, tonytopper and uMathieu like this.
  6. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    182
    So did you manage to start using preprocessor?
     
  7. tonytopper

    tonytopper

    Joined:
    Jun 25, 2018
    Posts:
    226
    Native support would be nice. Has anybody come across a tutorial, Open Source project, etc. on getting either SASS or LESS setup for USS?

    Would be nice to not have to reinvent the wheel here.

    An AssetImporter, or some other automation, would be needed as well. Seems like an opportunity to contribute something important to the Unity community.
     
  8. DavidNLN

    DavidNLN

    Joined:
    Sep 27, 2018
    Posts:
    90
    Another up vote here, been using SASS for years and it's a great experience
     
  9. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    I didn't, unfortunately. It's something I'd still love to try, but native support would be pretty great.