using UnityEngine;
using UnityEngine.UI;
using System.Runtime.InteropServices;
public class PlatformDetector : MonoBehaviour
{
public bool isTouch;
[DllImport("__Internal")]
private static extern void DetectPlatform(); // Calling JS function
void Start()
{
#if !UNITY_EDITOR && UNITY_WEBGL
DetectPlatform(); // Call JavaScript function only in WebGL
#endif
}
// This method is called from JavaScript
public void SetPlatform(string platformState)
{
//isTouch = bool.Parse(platformState);
Debug.Log(platformState);
isTouch = platformState == "Mobile" ? true : false;
}
}