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?
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.
(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)