失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > Unity区分安卓 苹果是平板还是手机

Unity区分安卓 苹果是平板还是手机

时间:2019-03-11 01:44:15

相关推荐

Unity区分安卓 苹果是平板还是手机

#if UNITY_ANDROIDfloat physicscreen = Mathf.Sqrt(Screen.width * Screen.width + Screen.height * Screen.height) / Screen.dpi;if (physicscreen >= 7f){Debug.Log("安卓平板");}else{Debug.Log("安卓手机");}#elif UNITY_IPHONEDebug.Log(iPhone.generation);string iP_genneration = UnityEngine.iOS.Device.generation.ToString(); //The second Mothod: //string iP_genneration=SystemInfo.deviceModel.ToString();if (iP_genneration.Substring(0, 3) == "iPa"){Debug.Log("苹果平板");}else{Debug.Log("苹果手机");}#endif

如果觉得《Unity区分安卓 苹果是平板还是手机》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。