Use the **Set Input Mode UI **node.
In Play-in-Editor you may also have to change a setting in the editor settings so you don’t have to click in the viewport to gain control. I think it’s in the Play advanced settings (the little arrow next to the Play button -> Advanced).