void Start() { BoidWatcher boidWatcher = watcher.GetComponent <BoidWatcher>(); boidObjects = GameObject.FindGameObjectsWithTag("Boid"); watcherRb = watcher.GetComponent <Rigidbody>(); foreach (GameObject boid in boidObjects) { rigidbodies.Add(boid.GetComponent <Rigidbody>()); } }
void Start() { isDivided = false; BoidWatcher boidWatcher = watcher.GetComponent <BoidWatcher>(); watcherRb = watcher.GetComponent <Rigidbody>(); boidObjects = GameObject.FindGameObjectsWithTag("Boid"); foreach (GameObject boid in boidObjects) { rigidbodies.Add(boid.GetComponent <Rigidbody>()); boid.SetActive(false); } Debug.Log(boidObjects.Length); }