예제 #1
0
 void EnsureTargetArchitecturesAreSupported(BuildTargetGroup buildTargetGroup)
 {
     if (PlayerSettings.GetArchitecture(buildTargetGroup) != k_TargetArchitectureArm64)
     {
         throw new BuildFailedException("ARKit XR Plugin only supports the ARM64 architecture. See Player Settings > Other Settings > Architecture.");
     }
 }
            public void OnPreprocessBuild(BuildReport report)
            {
                if (report.summary.platform != BuildTarget.iOS)
                {
                    return;
                }

                if (string.IsNullOrEmpty(PlayerSettings.iOS.cameraUsageDescription))
                {
                    throw new BuildFailedException("ARKit requires a Camera Usage Description (Player Settings > iOS > Other Settings > Camera Usage Description)");
                }

                SelectStaticLib();

                EnsureMetalIsFirstApi();

                if (ARKitSettings.GetOrCreateSettings().requirement == ARKitSettings.Requirement.Required)
                {
                    EnsureMinimumBuildTarget();
                    EnsureTargetArchitecturesAreSupported(report.summary.platformGroup);
                }
                else if (PlayerSettings.GetArchitecture(report.summary.platformGroup) == k_TargetArchitectureUniversal)
                {
                    EnsureOpenGLIsUsed();
                }

                BuildHelper.AddBackgroundShaderToProject(ARKitCameraSubsystem.backgroundShaderName);
            }
    /// <summary>
    /// 預設IOS資料(取現在的PlayerSetting)
    /// </summary>
    private void DefaultSetIOS()
    {
        SDIOSSet aTmpSet = new SDIOSSet();

        // Resolution and Presentation
        aTmpSet.RequiresFullScreen             = PlayerSettings.iOS.requiresFullScreen;
        aTmpSet.StatusBarHidden                = PlayerSettings.statusBarHidden;
        aTmpSet.StatusBarStyle                 = PlayerSettings.iOS.statusBarStyle;
        aTmpSet.ShowActivityIndicatorOnLoading = PlayerSettings.iOS.showActivityIndicatorOnLoading;
        // Debugging and crash reporting
        aTmpSet.ActionOnDotNetUnhandledException = PlayerSettings.actionOnDotNetUnhandledException;
        aTmpSet.LogObjCUncaughtExceptions        = PlayerSettings.logObjCUncaughtExceptions;
        aTmpSet.EnableCrashReportAPI             = PlayerSettings.enableCrashReportAPI;
        // Identification
        aTmpSet.BundleIDIOS = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.iOS);
        aTmpSet.BuildNumber = PlayerSettings.iOS.buildNumber;
        aTmpSet.AppleEnableAutomaticSigning = PlayerSettings.iOS.appleEnableAutomaticSigning;
        aTmpSet.AppleDeveloperTeamID        = PlayerSettings.iOS.appleDeveloperTeamID;
        aTmpSet.ProvisioningProfileID       = PlayerSettings.iOS.iOSManualProvisioningProfileID;
        // Configuration
        aTmpSet.ScriptingBackend        = PlayerSettings.GetScriptingBackend(BuildTargetGroup.iOS);
        aTmpSet.ApiCompatibilityLevel   = PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.iOS);
        aTmpSet.TargetDevice            = PlayerSettings.iOS.targetDevice;
        aTmpSet.SDKVersion              = PlayerSettings.iOS.sdkVersion;
        aTmpSet.TargetOSVersionString   = PlayerSettings.iOS.targetOSVersionString;
        aTmpSet.PrepareIOSForRecording  = SDDataMove.GetBoolPlayerSetting("Prepare IOS For Recording");
        aTmpSet.RequiresPersistentWiFi  = PlayerSettings.iOS.requiresPersistentWiFi;
        aTmpSet.AppInBackgroundBehavior = PlayerSettings.iOS.appInBackgroundBehavior;
        aTmpSet.Architecture            = PlayerSettings.GetArchitecture(BuildTargetGroup.iOS);
        // Optimization
        aTmpSet.ScriptCallOptimizationLevel = PlayerSettings.iOS.scriptCallOptimization;
        aTmpSet.StripEngineCode             = PlayerSettings.stripEngineCode;
        aTmpSet.StripLevel = PlayerSettings.strippingLevel;
        // Scripting Define Symbols
        aTmpSet.ScriptDefineSymblos = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS);
        // Icon
        aTmpSet.IconOverride = true;
        SDDataMove.GetIconsGroup(BuildTargetGroup.iOS, ref mUIUseImages.IosIcons, ref aTmpSet.DefIcons);
        aTmpSet.PrerenderedIcon = PlayerSettings.iOS.prerenderedIcon;
        // Splash Images
        int aEmumTotal = Enum.GetNames(typeof(eMobileSplashScreen)).Length;

        mUIUseImages.IOSSplashImages = new Texture2D[aEmumTotal];
        aTmpSet.SplashImages         = new string[aEmumTotal];
        for (int i = 0; i < aEmumTotal; i++)
        {
            aTmpSet.SplashImages[i] = SDDataMove.GetSplashScreenPath((eMobileSplashScreen)i, ref mUIUseImages.IOSSplashImages[i]);
        }
        //-------------------------------------------------
        // Unity5 New
        aTmpSet.GraphicsType = PlayerSettings.GetGraphicsAPIs(BuildTarget.iOS);
        // Set Down
        mShowSetInfo.IOSSet = aTmpSet;
    }
예제 #4
0
    static void InitProject()
    {
        //====================iOS用====================.
        //カメラを使用するための表記が設定されていない場合は適当に設定.
        if (0 == PlayerSettings.iOS.cameraUsageDescription.Length)
        {
            PlayerSettings.iOS.cameraUsageDescription = AR_KIT_CAMERA_USAGE_DESCRIPTION;
        }
        //iOSの最小ターゲットバージョンをARKit用に設定する.
        float iosVersion = float.Parse(PlayerSettings.iOS.targetOSVersionString);

        if (11.0f > iosVersion)
        {
            PlayerSettings.iOS.targetOSVersionString = "11.0";
        }
        //iOSを64bitに設定.
        //0 - None, 1 - ARM64, 2 - Universal..
        if (1 != PlayerSettings.GetArchitecture(BuildTargetGroup.iOS))
        {
            PlayerSettings.SetArchitecture(BuildTargetGroup.iOS, 1);
        }

        //====================Android用====================.
        //AndroidのMinSDKVersionが低い場合はARCore向けに対応しているバージョンにする.
        if (AndroidSdkVersions.AndroidApiLevel24 > PlayerSettings.Android.minSdkVersion)
        {
            PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel24;
        }
        //ARCore向けにVulkenを使用しないようにする.
        if (true == PlayerSettings.GetGraphicsAPIs(BuildTarget.Android).Contains(UnityEngine.Rendering.GraphicsDeviceType.Vulkan))
        {
            UnityEngine.Rendering.GraphicsDeviceType[] graphicsDeviceTypeArray = new UnityEngine.Rendering.GraphicsDeviceType[1] {
                UnityEngine.Rendering.GraphicsDeviceType.OpenGLES3
            };
            PlayerSettings.SetGraphicsAPIs(BuildTarget.Android, graphicsDeviceTypeArray);
        }
        //ARM64向けにビルドさせるためにScriptBackendをIL2CPPにする.
        if (ScriptingImplementation.IL2CPP != PlayerSettings.GetScriptingBackend(BuildTargetGroup.Android))
        {
            PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
        }
        //ARM64向けにビルドさせる設定にする.
        if (0 == (PlayerSettings.Android.targetArchitectures & AndroidArchitecture.ARM64))
        {
            PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;
        }

        return;
    }
예제 #5
0
        public static void ShowArchitectureButton(BuildTargetGroup target)
        {
            bool flag;

            if (target == BuildTargetGroup.tvOS)
            {
                flag = PlayerSettings.tvOS.sdkVersion == tvOSSdkVersion.Simulator;
            }
            else
            {
                flag = PlayerSettings.iOS.sdkVersion == iOSSdkVersion.SimulatorSDK;
            }
            int scriptingBackend = (int)PlayerSettings.GetScriptingBackend(target);

            if (!flag)
            {
                int num3;
                int architecture = PlayerSettings.GetArchitecture(target);
                if (scriptingBackend == 1)
                {
                    if (target == BuildTargetGroup.tvOS)
                    {
                        num3 = 1;
                        PlayerSettingsEditor.BuildDisabledEnumPopup(new GUIContent("ARM64"), EditorGUIUtility.TextContent("Architecture"));
                    }
                    else
                    {
                        num3 = PlayerSettingsEditor.BuildEnumPopup <Architecture>(EditorGUIUtility.TextContent("Architecture"), architecture, kArchitectureOrder, kArchitectureDescriptions);
                    }
                }
                else
                {
                    num3 = 0;
                    PlayerSettingsEditor.BuildDisabledEnumPopup(new GUIContent("ARMv7"), EditorGUIUtility.TextContent("Architecture"));
                }
                if (num3 != architecture)
                {
                    PlayerSettings.SetArchitecture(target, num3);
                }
            }
            else if (scriptingBackend == 1)
            {
                PlayerSettingsEditor.BuildDisabledEnumPopup(EditorGUIUtility.TextContent("x86_64"), EditorGUIUtility.TextContent("Architecture"));
            }
            else
            {
                PlayerSettingsEditor.BuildDisabledEnumPopup(EditorGUIUtility.TextContent("i386"), EditorGUIUtility.TextContent("Architecture"));
            }
        }
        /// <summary>
        ///
        /// </summary>
        static void EnsureIOSArchitecture()
        {
            // Architecture value is ignored when using SimulatorSDK
            if (PlayerSettings.iOS.sdkVersion == iOSSdkVersion.SimulatorSDK)
            {
                return;
            }

            var architecture = (iOSArchitecture)PlayerSettings.GetArchitecture(BuildTargetGroup.iOS);

            if (architecture != iOSArchitecture.ARM64)
            {
                Debug.LogWarning(
                    $"WebRTC apps require a target architecture to be set {RequiredIOSArchitectures}. " +
                    $"Currently set to {architecture}");
            }
        }
예제 #7
0
 public bool PlayerSettingsArchitecture_iOS()
 {
     // PlayerSettings.GetArchitecture returns an integer value associated with the architecture of a BuildTargetPlatformGroup. 0 - None, 1 - ARM64, 2 - Universal.
     return(PlayerSettings.GetArchitecture(BuildTargetGroup.iOS) == 2);
 }
예제 #8
0
        public void FetchPlayerSettings()
        {
            var ps = Module.UserConfig.Json.PlayerSettings;

            FetchAllScriptDefines();

            ps.General.CompanyName = PlayerSettings.companyName;
            ps.General.ProductName = PlayerSettings.productName;

            //iOS
            ps.IOS.BundleID            = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.iOS);
            ps.IOS.AutomaticallySign   = PlayerSettings.iOS.appleEnableAutomaticSigning;
            ps.IOS.ProfileID           = PlayerSettings.iOS.iOSManualProvisioningProfileID;
            ps.IOS.TeamID              = PlayerSettings.iOS.appleDeveloperTeamID;
            ps.IOS.CameraUsageDesc     = PlayerSettings.iOS.cameraUsageDescription;
            ps.IOS.LocationUsageDesc   = PlayerSettings.iOS.locationUsageDescription;
            ps.IOS.MicrophoneUsageDesc = PlayerSettings.iOS.microphoneUsageDescription;
            //TODO: 未找到 //ps.IOS.BlueToothUsageDesc = iOSBuildPostProcessor.BlueToothUsageDesc;
            ps.IOS.TargetDevice            = PlayerSettings.iOS.targetDevice;
            ps.IOS.TargetSDK               = PlayerSettings.iOS.sdkVersion;
            ps.IOS.TargetMinimumIOSVersion = PlayerSettings.iOS.targetOSVersionString;
            ps.IOS.Architecture            = (UserConfig.PlayerSettings.IOSSettings.ArchitectureEnum)PlayerSettings.GetArchitecture(BuildTargetGroup.iOS);
            ps.IOS.StripEngineCode         = PlayerSettings.stripEngineCode;
            ps.IOS.ScriptCallOptimization  = PlayerSettings.iOS.scriptCallOptimization;

            //Android
            ps.Android.PreserveFramebufferAlpha = PlayerSettings.preserveFramebufferAlpha;
            //TODO: 未找到 Resolution Scaling Mode
            ps.Android.BlitType = PlayerSettings.Android.blitType;
            ps.Android.ProtectGraphicsMemory   = PlayerSettings.protectGraphicsMemory;
            ps.Android.PackageName             = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
            ps.Android.MinimumAPILevel         = PlayerSettings.Android.minSdkVersion;
            ps.Android.TargetAPILevel          = PlayerSettings.Android.targetSdkVersion;
            ps.Android.DeviceFilter            = PlayerSettings.Android.targetDevice;
            ps.Android.InstallLocation         = PlayerSettings.Android.preferredInstallLocation;
            ps.Android.ForceInternetPermission = PlayerSettings.Android.forceInternetPermission;
            ps.Android.ForceSDCardPermission   = PlayerSettings.Android.forceSDCardPermission;
            ps.Android.AndroidTVCompatibility  = PlayerSettings.Android.androidTVCompatibility;
            ps.Android.AndroidGame             = PlayerSettings.Android.androidIsGame;
            //TODO: 未找到 16.	Android GamePad Support
            ps.Android.StripEngineCode = PlayerSettings.stripEngineCode;
            ps.Android.UseObbMode      = PlayerSettings.Android.useAPKExpansionFiles;
            ps.Android.BuildSystem     = EditorUserBuildSettings.androidBuildSystem;
        }
예제 #9
0
        static bool settingProject()
        {
            bool isChange = false;

            var version = PlayerSettings.Android.minSdkVersion;

            if (version == AndroidSdkVersions.AndroidApiLevelAuto || version < AndroidSdkVersions.AndroidApiLevel24)
            {
                PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel24;
                isChange = true;
            }
            version = PlayerSettings.Android.targetSdkVersion;
            if (version == AndroidSdkVersions.AndroidApiLevelAuto || version < AndroidSdkVersions.AndroidApiLevel29)
            {
                PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevel29;
                isChange = true;
            }
            if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.Android) != ScriptingImplementation.IL2CPP)
            {
                PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
                isChange = true;
            }
            if (PlayerSettings.Android.targetArchitectures != AndroidArchitecture.ARM64)
            {
                PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;
                isChange = true;
            }
            var graphicsApi = PlayerSettings.GetGraphicsAPIs(BuildTarget.Android);

            if (graphicsApi.Length != 1 || graphicsApi[0] != UnityEngine.Rendering.GraphicsDeviceType.OpenGLES3)
            {
                PlayerSettings.SetGraphicsAPIs(BuildTarget.Android,
                                               new UnityEngine.Rendering.GraphicsDeviceType[] { UnityEngine.Rendering.GraphicsDeviceType.OpenGLES3 });
                isChange = true;
            }
            if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Android) != ApiCompatibilityLevel.NET_4_6)
            {
                PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Android, ApiCompatibilityLevel.NET_4_6);
                isChange = true;
            }

            string iosVersion = PlayerSettings.iOS.targetOSVersionString;

            string[] iosVersionSplit = iosVersion.Split('.');
            int      iosVersionMajor;

            if (iosVersionSplit.Length <= 0 || !int.TryParse(iosVersionSplit[0], out iosVersionMajor))
            {
                iosVersionMajor = -1;
            }
            int iosVersionMinor;

            if (iosVersionSplit.Length <= 1 || !int.TryParse(iosVersionSplit[1], out iosVersionMinor))
            {
                iosVersionMinor = -1;
            }
            if (iosVersionMajor < 11 || (iosVersionMajor == 11 && iosVersionMinor < 0))
            {
                PlayerSettings.iOS.targetOSVersionString = "11.0";
                isChange = true;
            }
            if (PlayerSettings.GetArchitecture(BuildTargetGroup.iOS) != 1)
            {
                PlayerSettings.SetArchitecture(BuildTargetGroup.iOS, 1);
                isChange = true;
            }
            if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.iOS) != ApiCompatibilityLevel.NET_4_6)
            {
                PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.iOS, ApiCompatibilityLevel.NET_4_6);
                isChange = true;
            }
            if (string.IsNullOrEmpty(PlayerSettings.iOS.cameraUsageDescription))
            {
                PlayerSettings.iOS.cameraUsageDescription = "Using head and hands tracking.";
                isChange = true;
            }

            if (PlayerSettings.defaultInterfaceOrientation != UIOrientation.LandscapeLeft)
            {
                PlayerSettings.defaultInterfaceOrientation = UIOrientation.LandscapeLeft;
                isChange = true;
            }

            if (!PlayerSettings.allowUnsafeCode)
            {
                PlayerSettings.allowUnsafeCode = true;
                isChange = true;
            }
            SetScriptingDefineSymbol("ENABLE_UNSAFE_CODE");

            if (isChange)
            {
                AssetDatabase.SaveAssets();
            }

            return(isChange);
        }