How can i check if webgl is being played on mobile environment?
I did google some examples on this but none of them worked properly.
I tried Input.touchSupported, and #if UNITY_IOS || UNITY_ANDROID.
any ideas?
Okay, i've just found the best way to do this.
http://answers.unity.com/answers/1698985/view.html
it worked right away.
assets/plugins/webgl/MyPlugin.jslib
var MyPlugin = {
IsMobile: function()
{
return UnityLoader.SystemInfo.mobile;
}
};
mergeInto(LibraryManager.library, MyPlugin);
in Unity
[DllImport("__Internal")]
private static extern bool IsMobile();
public bool isMobile()
{
#if !UNITY_EDITOR && UNITY_WEBGL
return IsMobile();
#endif
return false;
}