No inputs after lmb click

I want to have mouse look when holding RMB, and use mouse cursor to interract with objects when not hold RMB. My code is working before i do LMB click. After it i have no RMB input. How can i fix this?

Update: i solved problem by using unput mode game and ui and always lock mod for mouse. After that I could not turn the camera when the mouse rested on the edge of the screen even if cursor unseen. That problem i solved by moving mouse cursor to center of screen every frame in free look state. Dont know how good this solution is but it works.

Your screenshot is not enough to debug this, but your setup looks a lot like this issue:

[Bug report] Losing focus / input axis values 0 after releasing mouse button.