Accessing the Stylesheet importer from outside the UIElements namespace

The title pretty much says it all, but let me get into details a bit more.

We have written an .scss importer that creates a Stylesheet asset at the end of the process (calling a sass executable on the host during the import). Since we didn’t want the importer to simply write out the result to a new file (which is more like a converter than an importer) we take the result of the sass compiler and pass it directly on to the Stylesheet importer.

Right now the Stylesheet Importer is an internal class however, so we are accessing it via reflection, which might or might not break in the future. Is there any plan to expose the stylesheet importer interface in some format that is public or is runtime/editor importing of stylesheets from text simply something that is not going to be supported at all (officially)?

1 Like

It’s something we’re considering but not planned yet. Most of the use cases we heard so far were runtime related but you provided a great one for Editor and perhaps we could start from there. Taking note of this, thanks for sharing.

2 Likes

We have a similar use case: creating a design system similar to bootstrap or tailwind css from a configuration file (json). Any updates on this?

There is still no API available for that purpose. However, you might get away with Editor scripts that generate USS files, ask Unity to import them. You would need to check-in some generated USS files though.

1 Like