In an empty Unity project, when I go to “Search By Label” in a Project window, there are several labels listed, as in this picture:
[In a large project with many labelled assets, this list is different. My working theory is that the 15 most common labels are added to the list of labels that are easy to filter by, and, if the project has no labels, the most common labels from the Asset Store are used.]
I’d like to make it so that my level designers can filter things in the project quickly by label. Can I customize what shows up? Am I limited to 15 quickly chosen items? Is it possible to make labels that are unused in the project not show up in the list to filter by? (There isn’t, say, a “label manager” for the project?)
(I’m using Unity 5.0.x on the specific project I want designers to work on, although answers for the current version probably work the same.)
Thanks!
Yes, you can customize the Asset Labels for your project.
If you have an asset selected, you can set its label(s) by clicking the tag icon at the bottom-right of the inspector window. If you type in a new label name, and hit Enter
, it will create a custom label and assign it.
Here is an example where I am about to create a new tag, just before hitting Enter:
And a screenshot of after I typed in a new custom label, pressed enter, and selected the label icon again:
See the official documentation here for more information. Hope this helps!
First, there are a lot more labels than just the 15 or so in the list, if you search in the label search box you will see the rest. Try typing in “Zomb” in the search bar to see what I mean.
Any label you enter in the label search bar can be added to an asset.
Second, yes, there are two ways to add new labels:
Method #1 Edit label.yml:
You will find label.yml in something like C:\Program Files\Unity\Hub\Editor\2019.3.11f1\Editor\Data\Resources
The file is a list of Label names and priorities, anything with a 2 shows up in the Label dropdown (the rest are searchable in the label search window)
Change the value of a label to “2”, or add a label and set it to 2 to appear in the label list, or set a lower number to remove it.
Method#2 Add Labels to a GameObject
Any labels that are already on a GameObject in your project can be a applied to any other asset. You can create an empty GameObject
, and then assign whatever labels you want in your project to it. You can do this in the Inspector window using the Label tool, in C# by using AssetDatabase.SetLabel()
, or by editing the meta data for that asset with a text editor if you like living dangerously. If you want to get fancy, you could make a custom editor to add tags using SetLabel()
also.