void Update() { if (trigger && Input.GetKeyDown(KeyCode.R)) { PlayerAdapter.SetVelocity(Vector2.zero); player.SetActive(false); gateParticleSystem.SetActive(true); gateParticleSystem.transform.position = player.transform.position; Invoke("DeactivateGemGameObject", gateParticleSystem.GetComponent <ParticleSystem>().main.duration); } }