- Home /
working with tags
hi ive been using tags for a while now and never really looked at the best way of using them in script.
has anyone got any general rules to make tags more efficient during runtime?
i remember reading something a while ago but cant find the page anymore, but im pretty sure it said to store all the tags in an array of a fixed size, and then call the objects from the array, is this right.
Answer by blackmethod · Jul 13, 2012 at 05:25 AM
Tags can be used for numerous things, I usually use them in functions themselves. Such as a player colliding with a box with the "player" tag,
function OnTriggerEnter (other : Collider)
{
if (other.tag == "Player)
{
// Do stuff here
}
}
This is all I've needed them for, if you need to find more just look up functions in the unity documentation.
Answer by Content1of_akind · Apr 07, 2019 at 08:08 PM
What if you are not trying to collide with the other game object, how can I still use the game object by its tag?
Your answer
Follow this Question
Related Questions
Trying to figure out tags, 1 Answer
Right Click to Ignore All But Terrain, How? 1 Answer
How to count collisions of the same tagged objects? 2 Answers
hit.gameObject.tag 2 Answers