Cursor locked not clicking

I have buttons in game world that are clickable. If mouse lockstate is none so it is visible and can move I can click on buttons. When I use mouse lockstate locked when it is in center, not visible I can’t click anything. How to fix this?

What you are describing is how it’s supposed to work. What do want it to do instead?

That cursor would be still in center of screen and not visible, but I could use it as usual, so I could click on buttons.

Are you talking about UI buttons, or are these objects in your scene? How were you detecting whether they were clicked before?

One thing that you can do is perform a raycast from your camera’s forward vector when the player presses the mouse button.

The raycast is successful, then you will know whether the button is in the center of the view and also close enough to be pushable (use the maxDistance parameter to indicate how close the player needs to be to the button).