ARTracking/Assets/BigFortuneWheels/Scripts/MKUtils/Touch/TouchManager.cs

32 lines
882 B
C#
Raw Permalink Normal View History

2024-09-10 22:01:36 -07:00
using UnityEngine;
using UnityEngine.EventSystems;
using System;
namespace Mkey
{
public class TouchManager : MonoBehaviour
{
/// <summary>
/// Return true touch pad run on mobile device
/// </summary>
public static bool IsMobileDevice()
{
//check if our current system info equals a desktop
if (SystemInfo.deviceType == DeviceType.Desktop)
{
//we are on a desktop device, so don't use touch
return false;
}
//if it isn't a desktop, lets see if our device is a handheld device aka a mobile device
else if (SystemInfo.deviceType == DeviceType.Handheld)
{
//we are on a mobile device, so lets use touch input
return true;
}
return false;
}
}
}