private IEnumerator OnMissileCollision() { collisionVFX = MissilePool.Instance.GetCollisionVFX(); // Get VFX instance from object pool collisionVFX.transform.position = this.transform.position; // Position VFX instance to the missile object collisionVFX.transform.localRotation = this.transform.localRotation; // Set rotation of VFX instance to be the same as the missile collisionVFX.GetComponent <VisualEffect>().Play(); // Play VFX CameraShake.CameraImpulse(0.25f); // Camera shake model.SetActive(false); // Deactive the missile model boxCollider.enabled = false; // Disable the missile collider yield return(new WaitForSeconds(0.75f)); // Wait for the VFX to play out gameObject.SetActive(false); // Deactive the entire missile object model.SetActive(true); // Activate model before returning to pool boxCollider.enabled = true; // Enable collider before returning to pool MissilePool.Instance.AddMissileToPool(gameObject); // Return missile to pool MissilePool.Instance.AddCollisionVFXToPool(collisionVFX); // Return VFX to pool }