void Update() { if (raisingPowerup) { if (myPowerup != null && myPowerup.transform.position.y < transform.position.y + 1) { myPowerup.transform.position += Vector3.up * Time.deltaTime * raiseSpeed; if (myPowerup.transform.position.y > transform.position.y + 1) { myPowerup.transform.position = transform.position + Vector3.up * 1.0f; Mushroom m = myPowerup.GetComponent <Mushroom> (); if (m != null) { m.Activate(); } //Destroy (this); } } else { Destroy(this); } } }