// On collision with a powerup, add it void OnTriggerEnter(Collider other) { PowerupController powerup = other.gameObject.GetComponent <PowerupController>(); if (powerup != null) { ActivatePowerup(powerup.type); powerup.Pickup(gameObject); } }