- Home /
tag for 3.3
The Tag system in unity 3.3 and 3.4 is very confusing can anybody help me out? all the references out there is pointing me to older versions where it says you just type it in it isnt working like that for me.
Answer by Graham-Dunnett · Jul 27, 2011 at 10:53 AM
Shouldn't be confusing...
Use Edit->Project Settings->Tags to bring up the Tag manager in the Inspector. Open up the Tag disclosure triangle, to reveal the array of tags that Unity knows about. By default there are no Tags, so just type one into the box to the right of "Element 0" and press Enter. The Tag is added and the array increases in size by one. Keep entering your tags.
To assign a Tag to a Game Object select it in the Hierarchy or Scene view. The use the Tag drop down and the list of known tags will appear. Choose the tag you want. (Note the drop down list has an option for you to add a new tag, this just takes you to the Tag Manager you used above.)
To use the tag in your game, just use the GameObject.CompareTag API, or GameObject.FindWithTag API, or GameObject.FindGameObjectsWithTag API.
HOLY COW! i was looking for that all last night nobody said enter your tag to the right of element 0 i was sitting there trying to put it in like layer eight! your a life saver man that box should really appear even if you dont click on it
ha ha i feel like such an idiot now. it says element. elements are tags. layers are layers.... ah. it all makes sense now!
It's really silly how tags and layers are inspected together like that. I've made the same mistake more than once, so either we're lots of idiots or the UI is poorly considered.