Skip to main content
 首页 » 资源教程 » Unity3D教程

Unity3d的IOS平台打包的品质控制

2016年09月02日 20:15:555960

 public static void SetGameQuality(){
#if UNITY_IOS
        iPhoneGeneration iOSGen = iPhone.generation;
        if(Debug.isDebugBuild){
            Debug.Log("iPhone.generation     : " + iPhone.generation);
            Debug.Log("SystemInfo.deviceType : " + SystemInfo.deviceType);
            Debug.Log("SystemInfo.deviceModel: " + SystemInfo.deviceModel);
        Debug.Log("cur Quality :" + QualitySettings.GetQualityLevel());
        }
        if (iOSGen == iPhoneGeneration.iPhone3GS) {

            QualitySettings.SetQualityLevel((int)QualityLevel.Fastest);
            
        } else if (iOSGen == iPhoneGeneration.iPhone4) {
            
            QualitySettings.SetQualityLevel((int)QualityLevel.Fastest);
            
        } else if (iOSGen == iPhoneGeneration.iPhone4S) {
            Debug.Log("iphone4s set level Simple");
            QualitySettings.SetQualityLevel((int)QualityLevel.Simple);
            
        }else if (iOSGen == iPhoneGeneration.iPhone5 || iOSGen == iPhoneGeneration.iPhone5C || iOSGen == iPhoneGeneration.iPhone5S) {
            
            QualitySettings.SetQualityLevel(3);
            
        } else if (iOSGen == iPhoneGeneration.iPad1Gen) {
            
            QualitySettings.SetQualityLevel(2);
            
        } else if (iOSGen == iPhoneGeneration.iPad2Gen) {
            
            QualitySettings.SetQualityLevel(3);
            
        } else if (iOSGen == iPhoneGeneration.iPad3Gen) {
            
            QualitySettings.SetQualityLevel(3);
            
        } else if (iOSGen == iPhoneGeneration.iPodTouch3Gen) {
            
            QualitySettings.SetQualityLevel(3);    
            
        } else if (iOSGen == iPhoneGeneration.iPodTouch4Gen) {
            
            QualitySettings.SetQualityLevel(3);    
            
        } else {

            if (Debug.isDebugBuild) { Debug.LogWarning("Can't detect iOS device type."); }
            
            string device = SystemInfo.deviceModel;
            
            if (device == "iPhone") {
                
                if (Debug.isDebugBuild) { Debug.Log("Device type iPhone"); }
                
                QualitySettings.SetQualityLevel(3);

            } else if (device == "iPad") {
                
                if (Debug.isDebugBuild) { Debug.Log("Device type iPad"); }
                
                QualitySettings.SetQualityLevel(3);

            } else if (device == "iPod") {
                
                if (Debug.isDebugBuild) { Debug.Log("Device type iPod"); }
                
                QualitySettings.SetQualityLevel(1);
                
            }
        }
        //Debug.Log("then cur Quality :" + QualitySettings.GetQualityLevel());
#endif
    }

评论列表暂无评论
发表评论