private void OnPauseMenuOpened() { Cursor.lockState = CursorLockMode.None; PlayerMovement playerMovement = GetComponent <PlayerMovement>(); ThirdPersonCamera thirdPersonCamera = GetComponent <ThirdPersonCamera>(); Spellcasting spellcasting = GetComponent <Spellcasting>(); Animator animator = GetComponent <Animator>(); Dancing dancing = GetComponent <Dancing>(); if (animator != null) { animator.SetFloat("Speed", 0); animator.SetBool("IsJumping", false); } if (playerMovement != null) { playerMovement.ResetSpeed(); playerMovement.enabled = false; } if (dancing != null) { dancing.enabled = false; dancing.StopDancing(); } if (thirdPersonCamera != null) { thirdPersonCamera.enabled = false; } if (spellcasting != null) { spellcasting.CmdSetCanCastSpells(false); } }