UIElementsSchema

This folder gets generated automatically. Is this something we should commit to version control? Or gitignore?

This is to help some IDEs auto-complete for you when you write UXML files. Both Rider and Visual Studio should support this. But it’s 100% optional. The reason it’s “auto” generated is because it contains not just our built-in types but also your custom element types. If you find the auto-complete feature useful, keep in version control, otherwise, it’s safe to gitignore.

4 Likes

Glad to have these! Suggestion: It would be nice to find a way to embed these in the packages themselves, or generate them into the Library folder, rather cluttering the Project folder.

Additionally, if we ignore them in Git, is it guaranteed they’ll be generated for anyone else pulling the branch? Ie. is it safe to ignore them, if we’d like to keep auto-complete behavior?

It’s up to you. Schema generation is not highly enforced and it’s a bit lazy. I don’t know exactly what the triggers are but I know it’s not something like .meta generation. You can ignore it and just make it an option for those that want the auto-completion. If someone uses the UI Builder more, or a text editor that doesn’t support schemas, they may not need the auto-completion.

Does Visual Studio Code support this?

I just wanted to pop in for anyone else who found this after a Google search that this an infuriating way to implement this, and I want you to know that you’re not alone if you think so, too.

A Project folder is a existential thing for a developer to manage. They need to know, broadly anyway, what’s in there and why. So having the (seemingly) only information on the entire Internet about these files be 4 years old and say that it’s “not highly enforced and a bit lazy” is not good. Is that still the case for Unity 2022.3 or Unity 6?

I have some web development background (and enjoy using UI Toolkit for that reason), so I know what an XML schema is, but I’d wager that most game developers don’t. This isn’t to mention the fact that “UIElements” is the namespace, but Unity has branded it “UI Toolkit” so it’s not guaranteed that all users will be able to clue out what this is because searching “UI Elements” in the Unity Manual returns one of those one-line pages that says “thing is thing” and is not helpful at all, while the UI Toolkit documentation makes scarce mention of “UIElements” at all.

Unity generates a lot of files, and developers have gotten comfortable with not knowing what each of them is, but that comfort relies on a status quo, scaffolded by series of truisms (“you can delete the Library folder”, etc.) that are passed between developers via a kind of phpBB oral tradition.

So it’s extra annoying to find these, spend a half hour trying to figure out what to do with them (with version control, etc), then seeing some but not all the answers on this page and knowing that places already exist for these kinds of files that would have saved a headache had they shown up there instead.

ProjectSettings maybe, since it includes user-created elements? Inside the UI Toolkit package, perhaps, or even inside the Editor installation folder, at least for the schema that are not project/user-specific? And of course, the Library folder seems perfect for it if they get auto-generated from time to time (how/when, I still don’t know)… and would you believe a Library/UIElements folder already exists?

Anyway, this is just a rant, but this seemed like such an easily-avoidable irritation.