Exemplo n.º 1
0
        public static void Deactivate()
        {
            AudioSettings.SetSpatializerPluginName(null);
            AudioSettingsExt.SetAmbisonicDecoderPluginName(null);
#pragma warning disable CS0618 // Type or member is obsolete
            PlayerSettings.virtualRealitySupported = false;
#pragma warning restore CS0618 // Type or member is obsolete
            PlayerSettings.Android.androidTVCompatibility = false;
            PlayerSettings.Android.ARCoreEnabled          = false;
            ApplleiOS.RequiresARKitSupport = false;
        }
Exemplo n.º 2
0
        public void Activate()
        {
            if (!string.IsNullOrEmpty(Spatializer))
            {
                var hasSpatializer = AudioSettings
                                     .GetSpatializerPluginNames()
                                     .Contains(Spatializer);

                if (hasSpatializer)
                {
                    AudioSettings.SetSpatializerPluginName(Spatializer);
                    AudioSettingsExt.SetAmbisonicDecoderPluginName(Spatializer);
                }
            }

            var buildTargetGroup = GetTargetGroup();

#pragma warning disable CS0618 // Type or member is obsolete
            var supportedVRSDKs = PlayerSettings.GetAvailableVirtualRealitySDKs(buildTargetGroup);
            var vrSDKs          = XRPlatforms
                                  .Distinct()
                                  .Select(x => x.ToString())
                                  .Where(supportedVRSDKs.Contains)
                                  .ToArray();

            var enableVR = vrSDKs.Any(sdk => sdk != "None");
            if (enableVR != PlayerSettings.GetVirtualRealitySupported(buildTargetGroup))
            {
                PlayerSettings.SetVirtualRealitySupported(buildTargetGroup, enableVR);
                if (enableVR && !vrSDKs.Matches(PlayerSettings.GetVirtualRealitySDKs(buildTargetGroup)))
                {
                    PlayerSettings.SetVirtualRealitySDKs(buildTargetGroup, vrSDKs);
                }
            }
#pragma warning restore CS0618 // Type or member is obsolete

            if (buildTargetGroup == BuildTargetGroup.WSA)
            {
                EditorUserBuildSettings.wsaBuildAndRunDeployTarget = WSABuildAndRunDeployTarget.LocalMachine;
                EditorUserBuildSettings.wsaUWPBuildType            = WSAUWPBuildType.D3D;
                PlayerSettings.WSA.inputSource = PlayerSettings.WSAInputSource.IndependentInputSource;
                if (Enum.TryParse(WsaSubtarget, out WSASubtarget sub))
                {
                    EditorUserBuildSettings.wsaSubtarget = sub;
                    PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.SpatialPerception, sub == WSASubtarget.HoloLens);
                }
            }
            else if (buildTargetGroup == BuildTargetGroup.Android &&
                     Enum.TryParse(AndroidSdkVersion, out AndroidSdkVersions sdkVersion))
            {
                PlayerSettings.Android.minSdkVersion = (AndroidSdkVersions)Math.Max(
                    (int)PlayerSettings.Android.minSdkVersion,
                    (int)sdkVersion);
            }
            else if (buildTargetGroup == BuildTargetGroup.iOS &&
                     Version.TryParse(IOSVersion, out var v) &&
                     ApplleiOS.TargetOSVersion < v)
            {
                ApplleiOS.TargetOSVersion = v;
            }

            var curDefines = Project.GetDefines();
            curDefines.AddRange(GetCompilerDefines());
            Project.SetDefines(curDefines);
        }