After screen orientation change on mobile, new input objects sometimes have UserInputState frozen in Begin state

After screen orientation change on mobile (I only tested this on samsung phone), new touch inputs within ~1s or so after the screen orientation change will have its UserInputState frozen in the Begin state. This means that even if I stop touching the screen, the input object corresponding to that touch will never have its UserInputState change to End.
After about 1s from the orientation change, all new touch inputs will function properly i.e. new InputObjects for those touches behave as expected.

Reproduction:

local uis = game:GetService("UserInputService")
local counter = 0
uis.TouchStarted:Connect(function(input)
    local count = counter
	print("touch input number", count, "detected. State:", input.UserInputState)
	input:GetPropertyChangedSignal("UserInputState"):Connect(function()
		if input.UserInputState == Enum.UserInputState.End then
			print("touch input number", count, "has ended")
		end
	end)
	counter += 1
end)

Now rotate the device like a madman and try to tap the screen a bunch of times right after the screen orientation changes. You should see something like “touch input number 5 detected…” but “touch input number 5 has ended” will never print. It doesn’t always happen and may take a couple of rotations to get the behavior.

This is an obscure bug I discovered a year ago when I was making a custom user input module, which I hooked up to a custom camera module. My module would detect for the InputEnded state in order to remove inputs that had ended. What I found was that after rotating the screen and tapping a bunch, some inputs would get stuck and the camera would pan around endlessly, even after I lifted my fingers from the screen.

Expected behavior

After screen orientation change, new touch inputs should have UserInputState begin as Begin, and end as End.

A private message is associated with this bug report

2 Likes