I searched around for the answer to this but without success. I know that some tags/layers have a special meaning or function and some that perhaps don’t.
I know how to create tags and layers and how I can use them and heard that some of the built-in layers enable certain functionality (like the Ignore Raycast). But, does anyone know where I can find the documentation or something that explains what the built-in layers and tags are for?
On a related note (but probably require its own topic) – is there any hope or plans for the documentation on the site to be upgraded?
There are way to many vague definitions that have little to no examples. Although the tutorials are fantastic and certainly help the new comer in many ways; fixing the online documentation would kick off a movement in Unity not seen since PHP came to the web (which has the best documentation format IMHO!!)
Right, I understand what they are used for in general.
My question is related to the built-in layers and tags – Is there any functionality attached to each one.
One example is the Ignore Raycast, which I assume that objects in this layer will be ignored by raycast colliders. Do the others provide some additional feature like this or are they “for examples” only?
Tags don’t have any functionality attached unless you program it, the default ones just exist for convenience.
As for the layers, I assume “Ignore Raycast” is not part of the “kDefaultRaycastLayers” mask in Physics.Raycast. I have never encountered any purpose for Water and TransparentFX, perhaps they are also there for convenience. As you said, it’s quite unclear in the manual.
I believe the other layers are directly related to the special effects used in the demonstration projects and tutorials Unity provides. Aside from Ignore Raycast, which the documentation mentions is left out of Raycast layers by default, those layers are just meant to be used at your convenience.
In the end, you could just make your own if you don’t like how they’re named, so it’s no big deal.
If you put objects on the TransparentFX layer, then things like lens flares show through them. The water objects from standard assets and pro assets use the Water layer…I don’t think it does anything special per se, so I assume it’s included by default since there’s no way to automatically add a layer when adding a prefab to the scene.
I agree, if built-in layers have their special purposes the docs should mention them somewhere, otherwise how would we take advantage of such functionality, most of us don’t have a source code license.
In a related note, could some of these layers be used by the editor? is it safe for me to use say built-in layer 7 for my editor scripts?
According to the manual page on tags, there are 7 built in tags:
“Untagged”
“Respawn”
“Finish”
“EditorOnly”
“MainCamera”
“Player”
and “GameController”.
But no, I haven’t found any documentation about what each of them do, though I have over time picked up knowledge about a few of them.
Things are generally ‘Untagged’ by default, though I don’t know if setting the tag to that would have the same effect as setting it to an empty string. Whichever camera is tagged as ‘MainCamera’ is, I assume, the one you will get by referencing ‘Camera.Main’ - I don’t know what will happen if you try to tag more than one, or no cameras, as ‘MainCamera’. And ‘EditorOnly’ means a gameobject will be left out when you build the game - I like this one when building my levels, since I might have a gameobject just holding a script or something that will generate a visible effect in the game, but not in the editor. So to make it visible in the editor, I give it an ‘EditorOnly’ child with whatever visible objects I like, knowing that that gameobject and any resources it uses won’t take up space in my compiled game. I’m afraid I don’t know specifically what the other 4 built-in tags do.