How to keep cursor show and lock?

if i set PlayerController’s property ShowMouseCursor, the cursor won’t be locked in the viewport after the first click, inspite of i have set the 【project setting/ input / default view mouse lock】to true and lock mode to CapturePermanently.
but what i need is both: show cursor and lock!
how to get them together?

So what you are trying to do is lock the mouse to the viewport and then keep it locked after you leave the session then go back in?
If that is the case just add a tick event for a recurring mouse capture.

Here is something i have put together for you: