Tracking the number of gameobjects in a scene

I need help figuring out how to track or count the current number of a certain gameobject tag “questbox” in my scene. Any help would be awesome thanks!

1 Like

This has been answered many times before. But here is my script. It prints out the number of GameObjects with specific tag (in this case “questbox”):

var myGameObjects : GameObject[];

function Start () {
    myGameObjects = GameObject.FindGameObjectsWithTag("questbox");
    Debug.Log(myGameObjects.length);
}

Other solution: Counting GameObjects with Tag (Int) - Questions & Answers - Unity Discussions

1 Like