To many objects with updates. How should I call all of them?

Hey guys,

I have an issue with my game running slowly. My question is should I have one script updating the objects that are active or should I have each object check to see if it’s active then update itself?

Right now I have about 50 GameObjects with almost all of them with their own update(). I don’t know if this is why my game is running slowly. Most of the objects are bullets that update() looks like this:

void Update () {
		if (isActive && state == Projectile.State.Active) {
			BulletMove ();	
		}
	}
	protected void BulletMove () {
		transform.Translate(0f, 0f, speedProjectile * Time.deltaTime);
		currentDistance += speedProjectile * Time.deltaTime;
		if (currentDistance > distanceMax) {
			Deactivate ();
		}
	}

I have a couple of missiles that do the same thing. I also have 5 enemy ships that do the same thing. These just check to see if their state is active then they update.

No1 reason for a huge slowdown are Debug.Log or print statements in Update or any other kind of per-frame-callback (OnGUI, FixedUpdate, LateUpdate, OnXXXRender, …). Make sure you don’t spam your console with logs.

Other than that i would suggest to simply disable some gameobjects while in playmode and check the FPS to trackdown the source.