After disabling NUI focus the game does not register first keypress with IsControlJustPressed
, starts working on second and subsequent keypresses.
In the following repro code, upon pressing ENTER, NUI Focus is toggled, on second press of ENTER nothing happens, on third ENTER press NUI gets toggled again and on fourth ENTER press nothing happens again.
Expected behaviour would be that for every ENTER keypress NUI would toggle.
Citizen.CreateThread(function()
while true do
Wait(0)
if IsControlJustPressed(1, 176) then
print("ENTER PRESSED")
print('toggling focus')
SetNuiFocus(true, true)
Wait(100)
SetNuiFocus(false, false)
print("focus toggled")
end
end
end)```