unlock cursor!

when i write Cursor.lockState = CursorLockMode.None; and Cursor.visible = true;
cursor is visible.But i cant move it.i want something like when i press the escape button for my inventory can you help me?

In Edit Mode (while your playing your game in Unity) theres an automatic “fail-safe” that when you press Escape, you gain access to your cursor again… In Release Mode (once you build your game and play it outside Unity), you dont have that “fail-safe” anymore, thats something to note while testing…

There is also “Confined” you could try.

If none of this is working, look through your other scripts to see if anything else is constantly setting the cursors lock state. Its possible something else is forcing it to “Locked”

Also, where are you writing this? In some function thats triggered when the user presses “Escape”, in Update in an Input key event for Escape? Location could also be a factor.

can someone help me?

You can unlock and make cursor visible by holding the Escape key… until you hold down the Esc it wont be invisible or locked anymore.
If you’re talking about an exported project, well you should script it. e.g. :

    private void Update()
    {
        if (Input.GetButtonDown("Puase"))
        {
            //Actives Menu Canvas
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible = true;
        }
    }