static CustomScriptAssembly()
        {
            // When removing a platform from Platforms, please add it to DeprecatedPlatforms.
            DiscoveredTargetInfo[] buildTargetList = BuildTargetDiscovery.GetBuildTargetInfoList();
            // Need extra slot for Editor which is not included in the build target list
            Platforms    = new CustomScriptAssemblyPlatform[buildTargetList.Length + 1];
            Platforms[0] = new CustomScriptAssemblyPlatform("Editor", BuildTarget.NoTarget);
            for (int i = 1; i < Platforms.Length; i++)
            {
                Platforms[i] = new CustomScriptAssemblyPlatform(
                    BuildTargetDiscovery.GetScriptAssemblyName(buildTargetList[i - 1]),
                    buildTargetList[i - 1].niceName,
                    buildTargetList[i - 1].buildTargetPlatformVal);
            }

#pragma warning disable 0618
            DeprecatedPlatforms = new CustomScriptAssemblyPlatform[]
            {
                new CustomScriptAssemblyPlatform("PSMobile", BuildTarget.PSM),
                new CustomScriptAssemblyPlatform("Tizen", BuildTarget.Tizen),
                new CustomScriptAssemblyPlatform("WiiU", BuildTarget.WiiU),
                new CustomScriptAssemblyPlatform("Nintendo3DS", BuildTarget.N3DS),
                new CustomScriptAssemblyPlatform("PSVita", BuildTarget.PSP2),
            };
#pragma warning restore 0618

            OptinalUnityAssemblies = new[]
            {
                new CustomScriptOptinalUnityAssembly("Test Assemblies", OptionalUnityReferences.TestAssemblies, "When enabled, this assembly is only used in tests, not in in player builds. Predefined assemblies won’t reference this assembly.", "Predefined Assemblies (Assembly-CSharp.dll etc) will not reference this assembly.\nThis assembly will only be used for tests and will not be included in player builds."),
            };
        }
        internal void VuforiaGUI(BuildTargetGroup targetGroup)
        {
            if (!BuildTargetDiscovery.PlatformGroupHasVRFlag(targetGroup, VRAttributes.SupportVuforia) ||
                !m_VuforiaInstalled)
            {
                return;
            }

            // Disable toggle when Vuforia is in the VRDevice list and VR Supported == true
            bool vuforiaEnabled;
            var  shouldDisableScope = VREditor.GetVREnabledOnTargetGroup(targetGroup) && GetVRDeviceElementIsInList(targetGroup, "Vuforia");

            using (new EditorGUI.DisabledScope(shouldDisableScope))
            {
                if (shouldDisableScope && !PlayerSettings.GetPlatformVuforiaEnabled(targetGroup)) // Force Vuforia AR on if Vuforia is in the VRDevice List
                {
                    PlayerSettings.SetPlatformVuforiaEnabled(targetGroup, true);
                }

                vuforiaEnabled = PlayerSettings.GetPlatformVuforiaEnabled(targetGroup);

                EditorGUI.BeginChangeCheck();
                vuforiaEnabled = EditorGUILayout.Toggle(EditorGUIUtility.TrTextContent("Vuforia Augmented Reality Supported"), vuforiaEnabled);
                if (EditorGUI.EndChangeCheck())
                {
                    PlayerSettings.SetPlatformVuforiaEnabled(targetGroup, vuforiaEnabled);
                }
            }

            if (shouldDisableScope)
            {
                EditorGUILayout.HelpBox("Vuforia Augmented Reality is required when using the Vuforia Virtual Reality SDK.", MessageType.Info);
            }
        }
        internal void VuforiaGUI(BuildTargetGroup targetGroup)
        {
            // Vuforia is not supported in the Linux Editor
            if (Application.platform == RuntimePlatform.LinuxEditor)
                return;

            if (!BuildTargetDiscovery.PlatformGroupHasVRFlag(targetGroup, VRAttributes.SupportVuforia))
                return;

            m_SharedSettingShown = true;

            // Disable toggle when Vuforia is in the VRDevice list and VR Supported == true
            bool vuforiaEnabled;
            var shouldDisableScope = VREditor.GetVREnabledOnTargetGroup(targetGroup) && GetVRDeviceElementIsInList(targetGroup, "Vuforia");
            using (new EditorGUI.DisabledScope(shouldDisableScope))
            {
                if (shouldDisableScope && !PlayerSettings.vuforiaEnabled) // Force Vuforia AR on if Vuforia is in the VRDevice List
                    PlayerSettings.vuforiaEnabled = true;

                vuforiaEnabled = PlayerSettings.vuforiaEnabled;

                EditorGUI.BeginChangeCheck();
                vuforiaEnabled = EditorGUILayout.Toggle(EditorGUIUtility.TrTextContent("Vuforia Augmented Reality Supported*"), vuforiaEnabled);
                if (EditorGUI.EndChangeCheck())
                {
                    PlayerSettings.vuforiaEnabled = vuforiaEnabled;
                }
            }

            if (shouldDisableScope)
            {
                EditorGUILayout.HelpBox("Vuforia Augmented Reality is required when using the Vuforia Virtual Reality SDK.", MessageType.Info);
            }
        }
        static CustomScriptAssembly()
        {
            // When removing a platform from Platforms, please add it to DeprecatedPlatforms.
            DiscoveredTargetInfo[] buildTargetList = BuildTargetDiscovery.GetBuildTargetInfoList();

            // Need extra slot for Editor which is not included in the build target list
            Platforms    = new CustomScriptAssemblyPlatform[buildTargetList.Length + 1];
            Platforms[0] = new CustomScriptAssemblyPlatform("Editor", BuildTarget.NoTarget);
            for (int i = 1; i < Platforms.Length; i++)
            {
                Platforms[i] = new CustomScriptAssemblyPlatform(
                    BuildTargetDiscovery.GetScriptAssemblyName(buildTargetList[i - 1]),
                    buildTargetList[i - 1].niceName,
                    buildTargetList[i - 1].buildTargetPlatformVal);
            }

#pragma warning disable 0618
            DeprecatedPlatforms = new CustomScriptAssemblyPlatform[]
            {
                new CustomScriptAssemblyPlatform("PSMobile", BuildTarget.PSM),
                new CustomScriptAssemblyPlatform("Tizen", BuildTarget.Tizen),
                new CustomScriptAssemblyPlatform("WiiU", BuildTarget.WiiU),
                new CustomScriptAssemblyPlatform("Nintendo3DS", BuildTarget.N3DS),
                new CustomScriptAssemblyPlatform("PSVita", BuildTarget.PSP2),
                new CustomScriptAssemblyPlatform("LinuxStandalone32", BuildTarget.StandaloneLinux),
                new CustomScriptAssemblyPlatform("LinuxStandaloneUniversal", BuildTarget.StandaloneLinuxUniversal),
            };
#pragma warning restore 0618
        }
 private void Stereo360CaptureGUI(BuildTargetGroup targetGroup)
 {
     if (BuildTargetDiscovery.PlatformGroupHasVRFlag(targetGroup, VRAttributes.SupportStereo360Capture))
     {
         EditorGUILayout.PropertyField(m_Enable360StereoCapture, Styles.stereo360CaptureCheckbox);
     }
 }
 private static GUIContent[] GetStereoRenderingPaths(BuildTargetGroup targetGroup)
 {
     if (BuildTargetDiscovery.PlatformGroupHasVRFlag(targetGroup, VRAttributes.SupportStereoMultiviewRendering))
     {
         return(Styles.kMultiviewStereoRenderingPaths);
     }
     return(Styles.kDefaultStereoRenderingPaths);
 }
        internal void TangoGUI(BuildTargetGroup targetGroup)
        {
            if (!BuildTargetDiscovery.PlatformGroupHasVRFlag(targetGroup, VRAttributes.SupportTango))
                return;

            // Google Tango settings
            EditorGUILayout.PropertyField(m_AndroidEnableTango, EditorGUIUtility.TrTextContent("ARCore Supported"));
        }
        internal BuildPlatforms()
        {
            List <BuildPlatform> buildPlatformsList = new List <BuildPlatform>();

            DiscoveredTargetInfo[] buildTargets = BuildTargetDiscovery.GetBuildTargetInfoList();

            // Standalone needs to be first
            // Before we had BuildTarget.StandaloneWindows for BuildPlatform.defaultTarget
            // But that doesn't make a lot of sense, as editor use it in places, so it should agree with editor platform
            // TODO: should we poke module manager for target support? i think we can assume support for standalone for editor platform
            // TODO: even then - picking windows standalone unconditionally wasn't much better
            BuildTarget standaloneTarget = BuildTarget.StandaloneWindows;

            if (Application.platform == RuntimePlatform.OSXEditor)
            {
                standaloneTarget = BuildTarget.StandaloneOSX;
            }
            else if (Application.platform == RuntimePlatform.LinuxEditor)
            {
                standaloneTarget = BuildTarget.StandaloneLinux64;
            }

            buildPlatformsList.Add(new BuildPlatformWithSubtarget(BuildPipeline.GetBuildTargetGroupDisplayName(BuildTargetGroup.Standalone), "", "BuildSettings.Standalone",
                                                                  NamedBuildTarget.Standalone, standaloneTarget, (int)StandaloneBuildSubtarget.Player, true));

            buildPlatformsList.Add(new BuildPlatformWithSubtarget("Dedicated Server", "", "BuildSettings.DedicatedServer",
                                                                  NamedBuildTarget.Server, standaloneTarget, (int)StandaloneBuildSubtarget.Server, true));

            foreach (var target in buildTargets)
            {
                if (!target.HasFlag(TargetAttributes.IsStandalonePlatform))
                {
                    NamedBuildTarget namedBuildTarget = NamedBuildTarget.FromBuildTargetGroup(BuildPipeline.GetBuildTargetGroup(target.buildTargetPlatformVal));
                    buildPlatformsList.Add(new BuildPlatform(
                                               BuildPipeline.GetBuildTargetGroupDisplayName(namedBuildTarget.ToBuildTargetGroup()),
                                               target.iconName,
                                               namedBuildTarget,
                                               target.buildTargetPlatformVal,
                                               target.HasFlag(TargetAttributes.HideInUI)));
                }
            }

            foreach (var buildPlatform in buildPlatformsList)
            {
                buildPlatform.tooltip = buildPlatform.title.text + " settings";
            }

            buildPlatforms = buildPlatformsList.ToArray();
        }
        internal BuildPlatforms()
        {
            List <BuildPlatform> buildPlatformsList = new List <BuildPlatform>();

            DiscoveredTargetInfo[] buildTargets = BuildTargetDiscovery.GetBuildTargetInfoList();

            // Standalone needs to be first
            // Before we had BuildTarget.StandaloneWindows for BuildPlatform.defaultTarget
            // But that doesn't make a lot of sense, as editor use it in places, so it should agree with editor platform
            // TODO: should we poke module manager for target support? i think we can assume support for standalone for editor platform
            // TODO: even then - picking windows standalone unconditionally wasn't much better
            BuildTarget standaloneTarget = BuildTarget.StandaloneWindows;

            if (Application.platform == RuntimePlatform.OSXEditor)
            {
                standaloneTarget = BuildTarget.StandaloneOSX;
            }
            else if (Application.platform == RuntimePlatform.LinuxEditor)
            {
                standaloneTarget = BuildTarget.StandaloneLinux64;
            }

            buildPlatformsList.Add(new BuildPlatform(BuildPipeline.GetBuildTargetGroupDisplayName(BuildTargetGroup.Standalone), "BuildSettings.Standalone", BuildTargetGroup.Standalone, standaloneTarget, true));

            foreach (var target in buildTargets)
            {
                if (!target.HasFlag(TargetAttributes.IsStandalonePlatform))
                {
                    BuildTargetGroup btg = BuildPipeline.GetBuildTargetGroup(target.buildTargetPlatformVal);
                    buildPlatformsList.Add(new BuildPlatform(
                                               BuildPipeline.GetBuildTargetGroupDisplayName(btg),
                                               target.iconName,
                                               btg,
                                               target.buildTargetPlatformVal,
                                               !target.HasFlag(TargetAttributes.HideInUI)));
                }
            }

            // Facebook is a special case and needs to be added separately
            buildPlatformsList.Add(new BuildPlatform(BuildPipeline.GetBuildTargetGroupDisplayName(BuildTargetGroup.Facebook), "BuildSettings.Facebook", BuildTargetGroup.Facebook, BuildTarget.StandaloneWindows64, true));

            foreach (var buildPlatform in buildPlatformsList)
            {
                buildPlatform.tooltip = buildPlatform.title.text + " settings";
            }

            buildPlatforms = buildPlatformsList.ToArray();
        }
        private bool IsStereoRenderingModeSupported(BuildTargetGroup targetGroup, StereoRenderingPath stereoRenderingPath)
        {
            switch (stereoRenderingPath)
            {
            case StereoRenderingPath.MultiPass:
                return(true);

            case StereoRenderingPath.SinglePass:
                return(BuildTargetDiscovery.PlatformGroupHasVRFlag(targetGroup, VRAttributes.SupportSinglePassStereoRendering));

            case StereoRenderingPath.Instancing:
                return(BuildTargetDiscovery.PlatformGroupHasVRFlag(targetGroup, VRAttributes.SupportStereoInstancingRendering));
            }

            return(false);
        }
Beispiel #11
0
        internal static string ApiCompatibilityLevelToDotNetProfileArgument(ApiCompatibilityLevel compatibilityLevel, BuildTarget target)
        {
            switch (compatibilityLevel)
            {
            case ApiCompatibilityLevel.NET_2_0_Subset:
                return("legacyunity");

            case ApiCompatibilityLevel.NET_2_0:
                return("net20");

            case ApiCompatibilityLevel.NET_Unity_4_8:
            case ApiCompatibilityLevel.NET_Standard:
                return("unityaot-" + BuildTargetDiscovery.GetPlatformProfileSuffix(target));

            default:
                throw new NotSupportedException(string.Format("ApiCompatibilityLevel.{0} is not supported by IL2CPP!", compatibilityLevel));
            }
        }
Beispiel #12
0
 public virtual void MultithreadedRenderingGUI(BuildTargetGroup targetGroup)
 {
     // For platforms defined as IsMTRenderingDisabledByDefault in BuildTargetDiscovery::PreloadKnownBuildTargets (iPhone, tvOS, Android) the "Multithreaded Rendering" feature is controlled by PlayerSettings::m_MobileMTRenderingBaked (whose default is false)
     // For other platforms the "Multithreaded Rendering" feature is controlled by PlayerSettings::m_MTRendering. Default value is true (set during PlayerSettings::Reset)
     if (BuildTargetDiscovery.PlatformGroupHasFlag(targetGroup, TargetAttributes.IsMTRenderingDisabledByDefault))
     {
         bool oldValue = PlayerSettings.GetMobileMTRendering(targetGroup);
         bool newValue = EditorGUILayout.Toggle(MultithreadedRenderingGUITooltip(), oldValue);
         if (oldValue != newValue)
         {
             PlayerSettings.SetMobileMTRendering(targetGroup, newValue);
         }
     }
     else
     {
         EditorGUILayout.PropertyField(m_MTRendering, m_MTRenderingTooltip);
     }
 }
Beispiel #13
0
        private int EditCompressionQuality(BuildTarget target, int compression, bool isCrunchedFormat, TextureImporterFormat textureFormat)
        {
            bool showAsEnum = !isCrunchedFormat && (BuildTargetDiscovery.PlatformHasFlag(target, TargetAttributes.HasIntegratedGPU) || (textureFormat == TextureImporterFormat.BC6H) || (textureFormat == TextureImporterFormat.BC7));

            if (showAsEnum)
            {
                int compressionMode = 1;
                if (compression == (int)TextureCompressionQuality.Fast)
                {
                    compressionMode = 0;
                }
                else if (compression == (int)TextureCompressionQuality.Best)
                {
                    compressionMode = 2;
                }

                int ret = EditorGUILayout.Popup(kCompressionQuality, compressionMode, kMobileCompressionQualityOptions);

                switch (ret)
                {
                case 0: return((int)TextureCompressionQuality.Fast);

                case 1: return((int)TextureCompressionQuality.Normal);

                case 2: return((int)TextureCompressionQuality.Best);

                default: return((int)TextureCompressionQuality.Normal);
                }
            }
            else
            {
                compression = EditorGUILayout.IntSlider(kCompressionQualitySlider, compression, 0, 100);
            }

            return(compression);
        }
Beispiel #14
0
 public static bool IsMobilePlatform(BuildTarget target)
 {
     return(BuildTargetDiscovery.PlatformHasFlag(target, TargetAttributes.HasIntegratedGPU));
 }
Beispiel #15
0
 internal static string GetTargetStringFromBuildTargetGroup(BuildTargetGroup target)
 {
     return(BuildTargetDiscovery.GetModuleNameForBuildTargetGroup(target));
 }
        public bool HandlePlatformSettings(BuildTarget buildTarget, List <TextureImporterPlatformSettings> platformSettings, ITexturePlatformSettingsView view, ITexturePlatformSettingsFormatHelper formatHelper)
        {
            Assert.IsTrue(platformSettings.Count > 0, "At least 1 platform setting is needed to display the texture platform setting UI.");

            var allOverride           = platformSettings[0].overridden;
            var allSize               = platformSettings[0].maxTextureSize;
            var allFormat             = platformSettings[0].format;
            var allCompressionQuality = platformSettings[0].compressionQuality;
            var allAlphaSplit         = platformSettings[0].allowsAlphaSplitting;

            var mixedOverride    = false;
            var mixedSize        = false;
            var mixedFormat      = false;
            var mixedCompression = false;
            var mixedAlphaSplit  = false;

            var overrideChanged    = false;
            var sizeChanged        = false;
            var formatChanged      = false;
            var compressionChanged = false;
            var alphaSplitChanged  = false;

            for (var i = 1; i < platformSettings.Count; ++i)
            {
                var settings = platformSettings[i];
                if (settings.overridden != allOverride)
                {
                    mixedOverride = true;
                }
                if (settings.maxTextureSize != allSize)
                {
                    mixedSize = true;
                }
                if (settings.format != allFormat)
                {
                    mixedFormat = true;
                }
                if (settings.compressionQuality != allCompressionQuality)
                {
                    mixedCompression = true;
                }
                if (settings.allowsAlphaSplitting != allAlphaSplit)
                {
                    mixedAlphaSplit = true;
                }
            }

            allOverride = view.DrawOverride(allOverride, mixedOverride, out overrideChanged);

            allSize = view.DrawMaxSize(allSize, mixedSize, mixedOverride || !allOverride, out sizeChanged);

            int[]    formatValues  = null;
            string[] formatStrings = null;

            formatHelper.AcquireTextureFormatValuesAndStrings(buildTarget, out formatValues, out formatStrings);

            allFormat = view.DrawFormat(allFormat, formatValues, formatStrings, mixedFormat, mixedOverride || !allOverride, out formatChanged);

            if (!mixedFormat && formatHelper.TextureFormatRequireCompressionQualityInput(allFormat))
            {
                bool showAsEnum = BuildTargetDiscovery.PlatformHasFlag(buildTarget, TargetAttributes.HasIntegratedGPU);

                if (showAsEnum)
                {
                    var compressionMode = 1;
                    if (allCompressionQuality == (int)TextureCompressionQuality.Fast)
                    {
                        compressionMode = 0;
                    }
                    else if (allCompressionQuality == (int)TextureCompressionQuality.Best)
                    {
                        compressionMode = 2;
                    }

                    compressionMode = view.DrawCompressionQualityPopup(compressionMode, mixedCompression, mixedOverride || !allOverride, out compressionChanged);

                    if (compressionChanged)
                    {
                        switch (compressionMode)
                        {
                        case 0: allCompressionQuality = (int)TextureCompressionQuality.Fast; break;

                        case 1: allCompressionQuality = (int)TextureCompressionQuality.Normal; break;

                        case 2: allCompressionQuality = (int)TextureCompressionQuality.Best; break;

                        default:
                            Assert.IsTrue(false, "ITexturePlatformSettingsView.DrawCompressionQualityPopup should never return compression option value that's not 0, 1 or 2.");
                            break;
                        }
                    }
                }
                else
                {
                    allCompressionQuality = view.DrawCompressionQualitySlider(allCompressionQuality, mixedCompression, mixedOverride || !allOverride, out compressionChanged);
                }

                // show the ETC1 split option only for sprites on platforms supporting ETC.
                bool isETCPlatform       = TextureImporter.IsETC1SupportedByBuildTarget(buildTarget);
                bool isETCFormatSelected = TextureImporter.IsTextureFormatETC1Compression((TextureFormat)allFormat);
                if (isETCPlatform && isETCFormatSelected)
                {
                    allAlphaSplit = view.DrawAlphaSplit(allAlphaSplit, mixedAlphaSplit, mixedOverride || !allOverride, out alphaSplitChanged);
                }
            }

            if (overrideChanged || sizeChanged || formatChanged || compressionChanged || alphaSplitChanged)
            {
                for (var i = 0; i < platformSettings.Count; ++i)
                {
                    if (overrideChanged)
                    {
                        platformSettings[i].overridden = allOverride;
                    }
                    if (sizeChanged)
                    {
                        platformSettings[i].maxTextureSize = allSize;
                    }
                    if (formatChanged)
                    {
                        platformSettings[i].format = allFormat;
                    }
                    if (compressionChanged)
                    {
                        platformSettings[i].compressionQuality = allCompressionQuality;
                    }
                    if (alphaSplitChanged)
                    {
                        platformSettings[i].allowsAlphaSplitting = allAlphaSplit;
                    }
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
 internal bool TargetGroupSupportsAugmentedReality(BuildTargetGroup targetGroup)
 {
     return(BuildTargetDiscovery.PlatformGroupHasVRFlag(targetGroup, VRAttributes.SupportVuforia) ||
            BuildTargetDiscovery.PlatformGroupHasVRFlag(targetGroup, VRAttributes.SupportTango));
 }