unity find game object code example
Example 1: how to find object by ag unity
yourObjects = GameObject.FindGameObjectsWithTag("Respawn");
Example 2: find gameobject with tag
GameObject.FindWithTag("Enemy");
Example 3: how to find gameobjects in unity
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public GameObject hand;
void Example()
{
hand = GameObject.Find("Hand");
hand = GameObject.Find("/Hand");
hand = GameObject.Find("/Monster/Arm/Hand");
hand = GameObject.Find("Monster/Arm/Hand");
}
}
Example 4: unity find gameobject
ExampleObject = GameObject.Find("Hand");
Example 5: unity gameobject.find
GameObject obj = GameObject.Find("/Parent/Child/ChildOfChild");