Advertisement

[Unity(Android)获取设备操作系统]

阅读量:

根据参考资料1,2。得到下面的 UNITY C++ 代码

private void Awake()
{
#if UNITY_ANDROID
str = "这里是安卓设备_";
#endif

#if UNITY_IPHONE
str = "这里是苹果设备>_<";
#endif

#if UNITY_STANDALONE_WIN
str = "我是从Windows的电脑上运行的T_T";
#endif
}

这篇文章 的 剩余代码 主要 是 参考资料3的,工程 也是 参考资料3的。

复制代码
 using System.Collections;

    
 using System.Collections.Generic;
    
 using UnityEngine;
    
 using UnityEngine.UI;//使用 该引用,才能获得 Text 组件。
    
  
    
 public class Android_Test : MonoBehaviour {
    
  
    
     private Transform canvasTras;//UGUI的Canvas
    
     private Text text;//用来显示 界面的文本
    
     private But

全部评论 (0)

还没有任何评论哟~