I've been trying to use a simple script to count the number of GameObjects to print to a GUI. I can't figure out how to properly do it. My difficulty is that Length always returns 1. How should I change this code?
public static int count = 0;
private GameObject[] getCount;
void Update () {
getCount = GameObject.FindGameObjectsWithTag("BallsTag");
count = getCount.Length;
}
↧