32 lines
882 B
C#
32 lines
882 B
C#
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|