Tutorial by Examples

Tags are typically applied via the editor; however, you can also apply tags via script. Any custom tag must be created via the Tags & Layers window before being applied to a game object. Setting Tags in the Editor With one or more game objects selected, you can select a tag from the inspecto...
Tags make it particularly easy to locate specific game objects. We can look for a single game object, or look for multiple. Finding a Single GameObject We can use the static function GameObject.FindGameObjectWithTag(string tag) to look for individual game objects. It is important to note that, i...
When comparing two GameObjects by Tags, it should be noted that the following would cause Garbage Collector overhead as a string is created everytime: if (go.Tag == "myTag") { //Stuff } When performing those comparisons inside Update() and other regular Unity's callback (or a ...

Page 1 of 1