Camera.ViewportSize.Y changes on mobile devices between join and character loading

Reproduction Steps
Having issues where users are joining the game, and their Camera.ViewportSize.Y prints a higher number than it actually is, and when their character loads, it prints a completely different number. At the moment, I myself am unable to replicate this on my mobile. User who is reporting this has a galaxy S21 Ultra 5G

StarterPlayerScripts>LocalScript

--// Set the device the player is playing on
local function SetDevice()
	if GuiService:IsTenFootInterface() or UserInputService.GamepadEnabled then -- On a console (or using controller)
		return "Console", false
	end
	
	if UserInputService.KeyboardEnabled then
		if RunService:IsStudio() then -- Testing (emulator Mobile/Tablet)
			if not UserInputService.TouchEnabled then -- Not on emulator
				return "PC", false
			end
		else -- In proper game, make sure keyboard enabled and 
			return "PC", false
		end
	end
	print(Camera.ViewportSize.Y) -- prints 826
	if Camera.ViewportSize.Y > 500 then -- On tablet
		return "Tablet", UserInputService.TouchEnabled
	end
	
	return "Mobile", UserInputService.TouchEnabled
end

local Device, IsTouch = SetDevice()

task.defer(Player.SetAttribute, Player, "IsTouch", IsTouch)
task.defer(Player.SetAttribute, Player, "Device", Device)

StarterGui>LocalScript

print("Setting size of bottom bar", Camera.ViewportSize.Y) -- prints 383

Top print is what’s printing in the start function, print second last is what’s printed when character has loaded

Expected Behavior
The correct number to be printed when a player joins

Actual Behavior
Completely different numbers printed

Issue Area: Engine
Issue Type: Display
Impact: Very High
Frequency: Constantly

It has been happening quite frequently on my Xiaomi Redmi 8, basically what happens is that it takes some time for the mobile to rotate the screen when loading into the game.
(PS: you should never rely on something like this)

2 Likes

Sorry for being late to this. We’ll take a look at this now.

1 Like

I’m going to assume this is the explanation and this requires no further investigation.

Please let us know if otherwise.