In this article we are going to find game objects within script.
Note:
Create a gameobject "script" attach your script with that gameobject.
Note: Name of the gameobject is case sensitive.
Tags are one of the easiest way to find gameobject.



Tags are case sensitive.
Note:
Create a gameobject "script" attach your script with that gameobject.
Way 1:Using gameobject name.
GameObject hand = GameObject.Find("Hand");
Hand is our gameobject.Note: Name of the gameobject is case sensitive.
Way 2:Using Tag.
Tags are one of the easiest way to find gameobject.
GameObject respawns = GameObject.FindGameObjectsWithTag("Respawn");Respawn is our created tag.
Note:Adding Tag to gameobject.
Step 1:Click Untagged And select Add Tag.

Step 2: Type your required TAG name and click Save.

Step 3:Click Untagged and Select the your created TAG.

Note:
Tags are case sensitive.
Comments
Post a Comment