野子电竞数据官网改版https://www.xxe.io/全新登场

  1. Screen

利用屏幕长宽,可以更完美的实现UI的适配

//屏幕分辨率
Resolution resolution = Screen.currentResolution;

//游戏运行时全屏
Screen.fullScreen = true;

//屏幕高度,宽度
int screenHeight = Screen.height;
int screenWidth = Screen.width;

//不息屏
Screen.sleepTimeout = SleepTimeout.NeverSleep;

  1. Aplacation

关于Application.dataPath以及相关资源读取,推荐Unity3D移动平台动态读取外部文件全解析 https://www.xxe.io/

    //设置游戏目标帧率,-1表示不限制,使用最快帧率
    Application.targetFrameRate = -1;
    
    //用浏览器打开链接
    Application.OpenURL("URL");
    
    //退出APP
    Application.Quit();

    // Assets文件夹路径
    string path = Application.dataPath;

    //设置是否后台运行
    Application.runInBackground = true;

    //获取系统语言
    SystemLanguage systemLanguage = Application.systemLanguage;

    //获取版本号
    string unityVersion = Application.version;

    //网络类型(无网络/3G4G/WIFI)
    NetworkReachability networkReachability = Application.internetReachability;
  1. DateTime

       //电量,电池状态
       float batteryLevel = SystemInfo.batteryLevel;
       string batteryStatus = SystemInfo.batteryStatus.ToString();
    
       //设备型号、名字、类型
       string deviceModel = SystemInfo.deviceModel;
       string deviceName = SystemInfo.deviceName;
       string deviceType = SystemInfo.deviceType.ToString();
    

待你幼稚完
9 声望2 粉丝