Device Simulator not detecting handheld

So I have activated Device Simulator in Unity 2021.2 and this is the script I have added to my scene:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DeviceCheck : MonoBehaviour
{
    public Camera myCamera;
    public GameObject map;

    // Start is called before the first frame update
    void Start()
    {
      

    }

    // Update is called once per frame
    void Update()
    {

        //Check if the device running this is a desktop
        if (SystemInfo.deviceType == DeviceType.Desktop)
        {
            Debug.Log("Desktop");
            myCamera.fieldOfView = 53;
            map.transform.localScale += new Vector3(0f, 0f, 0f);
        }

        //Check if the device running this is a handheld
        if (SystemInfo.deviceType == DeviceType.Handheld)
        {
            Debug.Log("Mobile");
            myCamera.fieldOfView = 40;
            map.transform.localScale += new Vector3(6f, 6f, 6f);
        }

    }
}

I would think that it should print “Mobile” when I am in simulator mode. But it keeps saying “Desktop”.
Anyone who can help me out with this?

Best,
Maarten

I just opened a blank project, downloaded the Device Simulator package, put this

void Start()
    {
        Debug.Log(SystemInfo.deviceType);
    }

in a script, attached it to the main camera, changed my Game mode to Simulator, and it showed this (see bottom left corner):

What Unity version are you on?

Ok so I think this is a bug in Unity 2021.2.0.a21.2949.
The console shows “Desktop”.
I’ve done the same in Unity 2019.4.9f1 and it shows “Handheld” like it should.

That was in 2020.3.12f1.

Edit: I just tried in 2021.1.12f1 and got the same outcome as you:


(also using Windows snip with Unity running in Device Simulator mode apparently crashes my display driver and forces me to hard reboot, losing a running blender mesh render and a running scientific sim, which is always fun)

that is always fun. lolllll. Hope you have everything back. I have submitted this bug to Unity.

1 Like