How to detect ROG Ally or other handheld devices?

I have a variation of my UI that I enable for handheld devices like the Switch and the Steam Deck (larger font sizes, etc).

I understand that you can use Steamworks to detect the Steam Deck, like SteamUtils.IsSteamRunningOnSteamDeck(). But, is there a more generic way for Unity to detect a handheld gaming device? And if not, do you think SystemInfo.deviceName would return “ROG Ally” or something like that? Unfortunately I don’t have one to test it myself (I might be able to ask someone to test it, though).

To be honest, don’t bother to develop for devices, which you or your team doesn’t have on hand. You will need to build and test frequently, while resolving bugs. Also you need be able to collect any crash logs.

Asking some friend to test occasionally is not viable for production.

So either get the device you are making game for, or drop the support.

3 Likes

Windows has a systeminfo command that can provide hardware info. For example this is what it says about my workstation (there are more details but this is the system section):

System Manufacturer:       Gigabyte Technology Co., Ltd.
System Model:              B550 AORUS MASTER
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: AMD64 Family 25 Model 33 Stepping 0 AuthenticAMD ~3401 Mhz

I don’t know the actual values that belong to the ROG Ally, and like @Antypodish said I wouldn’t try to support it without the actual device to verify everything does in fact work as it’s not at all guaranteed just because it works on other devices.

1 Like

I don’t have to officially support it, but it wouldn’t hurt to just do:

if (SystemInfo.deviceName == "ROG Ally")
{
    useHandheldUI = true;
}

It seems incredibly lazy for devs to skip doing this just because of some arbitrary rule about supported vs unsupported devices.

1 Like

Alternative: Just offer this UI option in the settings.

There’s a difference between “lazy” and “making things harder on yourself” that you missed. The reason you shouldn’t do this sort of thing is that it will make later debug processes more difficult if something happens on a single platform but not others. All of a sudden you’re dealing with vague shots in the dark because you have a conditional based on something you don’t own.

Yeah, there’s a toggle for it, so it’s just a matter of setting up the defaults for when you start the game.

I’m typically the programmer responsible for platform support with my contracts so it’s actual experience from having to deal with these platforms and not just an arbitrary rule made up to save time. It’s just wasting time hacking in support for a device you can’t troubleshoot. I don’t care if it seems easy. It’s almost never the case.

I like the idea of a slider to change the scale of the UI. It has the added bonus of doubling as an accessibility option.

2 Likes

True, Minecraft does exactly that quite well.

What is SystemInfo.deviceType returning for a Steam Deck?
https://docs.unity3d.com/ScriptReference/DeviceType.html

They have the following example in the docs, so the concept of “handheld” seems to exist in Unity:

        //Check if the device running this is a handheld
        if (SystemInfo.deviceType == DeviceType.Handheld)
        {
            m_DeviceType = "Handheld";
        }

Just ran this from a Linux build on a Steam Deck OLED with no Steamworks. Some of these returns are not strings, but they print this way via .ToString().

print(SystemInfo.deviceType);              // Desktop
print(SystemInfo.deviceModel);             // PC
print(SystemInfo.deviceName);              // <hostname>

print(SystemInfo.graphicsDeviceID);        // 5173
print(SystemInfo.graphicsDeviceType);      // OpenGLCore
print(SystemInfo.graphicsDeviceName);
    // AMD Radeon Graphics (vangogh, LLVM 15.0.7, DRM 3.54, 6.1.52-valve9-1-neptune-61)
print(SystemInfo.graphicsDeviceVersion);
    // OpenGL 4.6 (Core Profile) Mesa 23.1.3 (git-58f7632462)

print(SystemInfo.operatingSystem);         // Linux 6.1 SteamOS 3.5.7 64bit
print(SystemInfo.operatingSystemFamily);   // Linux
print(SystemInfo.processorType);           // AMD Custom APU 0405
print(SystemInfo.processorCount);          // 8
print(SystemInfo.processorFrequency);      // 1662

If anyone else could do a Windows build with the same prints, that would be useful to know how much Proton changes the app’s view of the world.