private static MetroScaledImage[] CreateScaledImages(PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale[] scales, string labelFormat, int[] widths, int[] heights)
 {
     if (((scales.Length == 0) || (scales.Length != widths.Length)) || (scales.Length != heights.Length))
     {
         throw new Exception("If you see this, it's a bug. Scales, widths and heights must all be equal and non-zero");
     }
     MetroScaledImage[] imageArray = new MetroScaledImage[scales.Length];
     for (int i = 0; i < scales.Length; i++)
     {
         imageArray[i] = new MetroScaledImage(type, scales[i], string.Format(labelFormat, (int) scales[i], widths[i], heights[i]), widths[i], heights[i]);
     }
     return imageArray;
 }
Example #2
0
        private void UpdateDefineSymbols()
        {
            foreach (BuildTargetGroup _curBuildTargetGroup in buildTargetGroups)
            {
                string[]      _curDefineSymbols = UnityPlayerSettings.GetScriptingDefineSymbolsForGroup(_curBuildTargetGroup).Split(defineSeperators, StringSplitOptions.RemoveEmptyEntries);
                List <string> _newDefineSymbols = new List <string>(_curDefineSymbols);

                // Asset type
#pragma warning disable
                if (kIsFullVersion)
                {
                    if (_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Remove(kLiteVersionMacro);
                    }
                }
                else
                {
                    if (!_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Add(kLiteVersionMacro);
                    }
                }
#pragma warning restore

                ApplicationSettings.Features      _supportedFeatures      = m_applicationSettings.SupportedFeatures;
                ApplicationSettings.AddonServices _supportedAddonServices = m_applicationSettings.SupportedAddonServices;

                // Regarding supported features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesAddressBook, kMacroAddressBook);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesBilling, kMacroBilling);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesCloudServices, kMacroCloudServices);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesGameServices, kMacroGameServices);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesMediaLibrary, kMacroMediaLibrary);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNetworkConnectivity, kMacroNetworkConnectivity);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNotificationService, kMacroNotificationService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesSharing, kMacroSharin);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesTwitter, kMacroTwitter);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesWebView, kMacroWebView);

                // Regarding supported addon features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesSoomlaGrow, kMacroSoomlaGrowService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesOneSignal, kMacroOneSignalService);

                // Now save these changes
                UnityPlayerSettings.SetScriptingDefineSymbolsForGroup(_curBuildTargetGroup, string.Join(";", _newDefineSymbols.ToArray()));
            }
        }
 public MetroScaledImage(PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale scale, string label, int width, int height)
 {
     this.type = type;
     this.scale = scale;
     this.label = label;
     this.width = width;
     this.height = height;
     this.imagePath = null;
     this.image = null;
 }
 public static bool GetCapability(PlayerSettings.WSACapability capability)
 {
   string capability1 = PlayerSettings.WSA.InternalGetCapability(capability.ToString());
   if (string.IsNullOrEmpty(capability1))
     return false;
   try
   {
     return (bool) TypeDescriptor.GetConverter(typeof (bool)).ConvertFromString(capability1);
   }
   catch
   {
     Debug.LogError((object) ("Failed to parse value  ('" + capability.ToString() + "," + capability1 + "') to bool type."));
     return false;
   }
 }
Example #5
0
        private void UpdateDefineSymbols()
        {
            Features      _supportedFeatures      = m_applicationSettings.SupportedFeatures;
            AddonServices _supportedAddonServices = m_applicationSettings.SupportedAddonServices;

                #if UNITY_ANDROID
            if (_supportedFeatures.UsesCloudServices && !_supportedFeatures.UsesGameServices)
            {
                string _error = "Cloud Services on Android needs Game Services feature to be enabled. Please enable Game Services now.";
                Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
                EditorUtility.DisplayDialog("Cross Platform Native Plugins - Alert", _error, "Ok");
            }

                #if USES_BILLING
            if (string.IsNullOrEmpty(NPSettings.Billing.Android.PublicKey))
            {
                string _error = "Please specify Public key in Billing Settings for using Billing feature. You can get this key from Google Play Developer Console -> Your App -> Development & Tools -> Services & API -> Licensing & in-app billing.";
                Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
            }
                #endif
                #endif

            if (_supportedAddonServices.UsesOneSignal)
            {
                if (!Directory.Exists("Assets/Standard Assets/OneSignal/src"))
                {
                    string _error = "Download OneSignal SDK from Github and move Assets/OneSignal/src folder to Assets/Standard Assets/OneSignal folder";
                    Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
                    EditorUtility.DisplayDialog("OneSignal Addon Compatibility", _error, "Ok");
                }
            }

            BuildTargetGroup[] _buildTargets = GetBuildTargets();
            foreach (BuildTargetGroup _target in _buildTargets)
            {
                string[]      _curDefineSymbols = UnityPlayerSettings.GetScriptingDefineSymbolsForGroup(_target).Split(defineSeperators, StringSplitOptions.RemoveEmptyEntries);
                List <string> _newDefineSymbols = new List <string>(_curDefineSymbols);

                // Asset type
                #pragma warning disable
                if (kIsFullVersion)
                {
                    if (_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Remove(kLiteVersionMacro);
                    }
                }
                else
                {
                    if (!_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Add(kLiteVersionMacro);
                    }
                }
                #pragma warning restore

                // Regarding supported features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesAddressBook, kAddressBookMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesBilling, kBillingMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesCloudServices, kCloudServicesMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesGameServices, kGameServicesMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesMediaLibrary, kMediaLibraryMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNetworkConnectivity, kNetworkConnectivityMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNotificationService, kNotificationServiceMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesSharing, kSharingMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesTwitter, kTwitterMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesWebView, kWebViewMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, m_utilitySettings.RateMyApp.IsEnabled, kRateMyAppMacro);

                // Regarding supported addon features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesSoomlaGrow, kMacroSoomlaGrowService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesOneSignal, kMacroOneSignalService);

                // Now save these changes
                UnityPlayerSettings.SetScriptingDefineSymbolsForGroup(_target, string.Join(";", _newDefineSymbols.ToArray()));
            }
        }
 private static MetroScaledImageGroup CreateScaledImageGroup(PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale[] scales, string labelFormat, int[] widths, int[] heights)
 {
     return new MetroScaledImageGroup(CreateScaledImages(type, scales, labelFormat, widths, heights));
 }
 private static extern string GetWSAImage(PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale scale);
Example #8
0
        private void AddStackTraceLoggingMenu(GenericMenu menu)
        {
            IEnumerator enumerator = Enum.GetValues(typeof(LogType)).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    LogType     logType     = (LogType)enumerator.Current;
                    IEnumerator enumerator2 = Enum.GetValues(typeof(StackTraceLogType)).GetEnumerator();
                    try
                    {
                        while (enumerator2.MoveNext())
                        {
                            StackTraceLogType stackTraceLogType = (StackTraceLogType)enumerator2.Current;
                            ConsoleWindow.StackTraceLogTypeData stackTraceLogTypeData;
                            stackTraceLogTypeData.logType           = logType;
                            stackTraceLogTypeData.stackTraceLogType = stackTraceLogType;
                            menu.AddItem(new GUIContent(string.Concat(new object[]
                            {
                                "Stack Trace Logging/",
                                logType,
                                "/",
                                stackTraceLogType
                            })), PlayerSettings.GetStackTraceLogType(logType) == stackTraceLogType, new GenericMenu.MenuFunction2(this.ToggleLogStackTraces), stackTraceLogTypeData);
                        }
                    }
                    finally
                    {
                        IDisposable disposable;
                        if ((disposable = (enumerator2 as IDisposable)) != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
            }
            finally
            {
                IDisposable disposable2;
                if ((disposable2 = (enumerator as IDisposable)) != null)
                {
                    disposable2.Dispose();
                }
            }
            int         num         = (int)PlayerSettings.GetStackTraceLogType(LogType.Log);
            IEnumerator enumerator3 = Enum.GetValues(typeof(LogType)).GetEnumerator();

            try
            {
                while (enumerator3.MoveNext())
                {
                    LogType logType2 = (LogType)enumerator3.Current;
                    if (PlayerSettings.GetStackTraceLogType(logType2) != (StackTraceLogType)num)
                    {
                        num = -1;
                        break;
                    }
                }
            }
            finally
            {
                IDisposable disposable3;
                if ((disposable3 = (enumerator3 as IDisposable)) != null)
                {
                    disposable3.Dispose();
                }
            }
            IEnumerator enumerator4 = Enum.GetValues(typeof(StackTraceLogType)).GetEnumerator();

            try
            {
                while (enumerator4.MoveNext())
                {
                    StackTraceLogType stackTraceLogType2 = (StackTraceLogType)enumerator4.Current;
                    menu.AddItem(new GUIContent("Stack Trace Logging/All/" + stackTraceLogType2), num == (int)stackTraceLogType2, new GenericMenu.MenuFunction2(this.ToggleLogStackTracesForAll), stackTraceLogType2);
                }
            }
            finally
            {
                IDisposable disposable4;
                if ((disposable4 = (enumerator4 as IDisposable)) != null)
                {
                    disposable4.Dispose();
                }
            }
        }
    public void Setup()
    {
#if UNITY_EDITOR
        // Get and parse args for player settings
        var args      = Environment.GetCommandLineArgs();
        var optionSet = DefineOptionSet();

        var unprocessedArgs = optionSet.Parse(args);

        PlayerSettings.SplashScreen.showUnityLogo = false;

        // Setup all-inclusive player settings
        PlayerSettings.SetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget, new[] { playerGraphicsApi });
        PlayerSettings.MTRendering  = mtRendering;
        PlayerSettings.graphicsJobs = graphicsJobs;
        PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, scriptingImplementation);


        // If Android, setup Android player settings
        if (EditorUserBuildSettings.selectedBuildTargetGroup == BuildTargetGroup.Android)
        {
            EditorUserBuildSettings.androidBuildType   = AndroidBuildType.Development;
            EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Internal;
            PlayerSettings.Android.minSdkVersion       = minimumAndroidSdkVersion;
            PlayerSettings.Android.targetSdkVersion    = targetAndroidSdkVersion;
        }

        // If iOS, setup iOS player settings
        if (EditorUserBuildSettings.selectedBuildTargetGroup == BuildTargetGroup.iOS)
        {
            PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, "com.unity3d.performance.benchmark");
            PlayerSettings.iOS.appleDeveloperTeamID             = appleDeveloperTeamId;
            PlayerSettings.iOS.appleEnableAutomaticSigning      = false;
            PlayerSettings.iOS.iOSManualProvisioningProfileID   = iOsProvisioningProfileId;
            PlayerSettings.iOS.iOSManualProvisioningProfileType = ProvisioningProfileType.Development;
        }

        PlayerSettings.virtualRealitySupported = enabledXrTargets.Count > 0;
        if (PlayerSettings.virtualRealitySupported)
        {
            PlayerSettings.virtualRealitySupported = true;
            UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(
                EditorUserBuildSettings.selectedBuildTargetGroup,
                enabledXrTargets.ToArray());
            PlayerSettings.stereoRenderingPath = stereoRenderingPath;
        }

        if (EditorUserBuildSettings.selectedBuildTargetGroup == BuildTargetGroup.Standalone)
        {
            SetQualitySettingsToUltra();
        }
        else
        {
            SetQualitySettingsToMedium();
        }

        var perfTestRun = ReadPerformanceTestRunJson();
        if (perfTestRun.PlayerSettings == null)
        {
            perfTestRun.PlayerSettings = new Unity.PerformanceTesting.PlayerSettings();
        }

        perfTestRun.PlayerSettings.EnabledXrTargets = enabledXrTargets;

        CreatePerformanceTestRunJson(perfTestRun);
#endif
    }
Example #10
0
        private void UpdateDefineSymbols()
        {
            ApplicationSettings.Features      _supportedFeatures      = m_applicationSettings.SupportedFeatures;
            ApplicationSettings.AddonServices _supportedAddonServices = m_applicationSettings.SupportedAddonServices;

#if UNITY_ANDROID
            if (_supportedFeatures.UsesCloudServices && !_supportedFeatures.UsesGameServices)
            {
                string _error = "Cloud Services on Android needs Game Services feature to be enabled. Please enable Game Services now.";
                Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
                EditorUtility.DisplayDialog("Cross Platform Native Plugins - Alert", _error, "Ok");
            }

#if USES_BILLING
            if (string.IsNullOrEmpty(NPSettings.Billing.Android.PublicKey))
            {
                string _error = "Please specify Public key in Billing Settings for using Billing feature. You can get this key from Google Play Developer Console -> Your App -> Development & Tools -> Services & API -> Licensing & in-app billing.";
                Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
            }
#endif
#endif

            foreach (BuildTargetGroup _curBuildTargetGroup in buildTargetGroups)
            {
                string[]      _curDefineSymbols = UnityPlayerSettings.GetScriptingDefineSymbolsForGroup(_curBuildTargetGroup).Split(defineSeperators, StringSplitOptions.RemoveEmptyEntries);
                List <string> _newDefineSymbols = new List <string>(_curDefineSymbols);

                // Asset type
#pragma warning disable
                if (kIsFullVersion)
                {
                    if (_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Remove(kLiteVersionMacro);
                    }
                }
                else
                {
                    if (!_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Add(kLiteVersionMacro);
                    }
                }
#pragma warning restore

                // Regarding supported features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesAddressBook, kMacroAddressBook);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesBilling, kMacroBilling);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesCloudServices, kMacroCloudServices);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesGameServices, kMacroGameServices);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesMediaLibrary, kMacroMediaLibrary);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNetworkConnectivity, kMacroNetworkConnectivity);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNotificationService, kMacroNotificationService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesSharing, kMacroSharin);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesTwitter, kMacroTwitter);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesWebView, kMacroWebView);

                // Regarding supported addon features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesSoomlaGrow, kMacroSoomlaGrowService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesOneSignal, kMacroOneSignalService);

                // Now save these changes
                UnityPlayerSettings.SetScriptingDefineSymbolsForGroup(_curBuildTargetGroup, string.Join(";", _newDefineSymbols.ToArray()));
            }
        }
 public static void SetCapability(PlayerSettings.WSACapability capability, bool value)
 {
   PlayerSettings.WSA.InternalSetCapability(capability.ToString(), value.ToString());
 }
 private static MetroScaledImage[] CreateScaledSquareImages(PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale[] scales, string labelFormat, int[] sizes)
 {
     return CreateScaledImages(type, scales, labelFormat, sizes, sizes);
 }
 public static void SetVisualAssetsImage(string image, PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale scale)
 {
   PlayerSettings.WSA.ValidateWSAImageType(type);
   PlayerSettings.WSA.ValidateWSAImageScale(scale);
   PlayerSettings.WSA.SetWSAImage(image, type, scale);
 }
 public static string GetVisualAssetsImage(PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale scale)
 {
   PlayerSettings.WSA.ValidateWSAImageType(type);
   PlayerSettings.WSA.ValidateWSAImageScale(scale);
   return PlayerSettings.WSA.GetWSAImage(type, scale);
 }
 private static void ValidateWSAImageScale(PlayerSettings.WSAImageScale scale)
 {
   switch (scale)
   {
     case PlayerSettings.WSAImageScale.Target16:
       break;
     case PlayerSettings.WSAImageScale.Target24:
       break;
     case PlayerSettings.WSAImageScale.Target48:
       break;
     case PlayerSettings.WSAImageScale._80:
       break;
     case PlayerSettings.WSAImageScale._100:
       break;
     case PlayerSettings.WSAImageScale._125:
       break;
     case PlayerSettings.WSAImageScale._140:
       break;
     case PlayerSettings.WSAImageScale._150:
       break;
     case PlayerSettings.WSAImageScale._180:
       break;
     case PlayerSettings.WSAImageScale._200:
       break;
     case PlayerSettings.WSAImageScale._240:
       break;
     case PlayerSettings.WSAImageScale.Target256:
       break;
     case PlayerSettings.WSAImageScale._400:
       break;
     default:
       throw new Exception("Unknown image scale: " + (object) scale);
   }
 }
 private static void ValidateWSAImageType(PlayerSettings.WSAImageType type)
 {
   PlayerSettings.WSAImageType wsaImageType = type;
   switch (wsaImageType)
   {
     case PlayerSettings.WSAImageType.StoreTileLogo:
       break;
     case PlayerSettings.WSAImageType.StoreTileWideLogo:
       break;
     case PlayerSettings.WSAImageType.StoreTileSmallLogo:
       break;
     case PlayerSettings.WSAImageType.StoreSmallTile:
       break;
     case PlayerSettings.WSAImageType.StoreLargeTile:
       break;
     case PlayerSettings.WSAImageType.PhoneAppIcon:
       break;
     case PlayerSettings.WSAImageType.PhoneSmallTile:
       break;
     case PlayerSettings.WSAImageType.PhoneMediumTile:
       break;
     case PlayerSettings.WSAImageType.PhoneWideTile:
       break;
     case PlayerSettings.WSAImageType.PhoneSplashScreen:
       break;
     case PlayerSettings.WSAImageType.UWPSquare44x44Logo:
       break;
     case PlayerSettings.WSAImageType.UWPSquare71x71Logo:
       break;
     case PlayerSettings.WSAImageType.UWPSquare150x150Logo:
       break;
     case PlayerSettings.WSAImageType.UWPSquare310x310Logo:
       break;
     case PlayerSettings.WSAImageType.UWPWide310x150Logo:
       break;
     default:
       if (wsaImageType == PlayerSettings.WSAImageType.PackageLogo || wsaImageType == PlayerSettings.WSAImageType.SplashScreenImage)
         break;
       throw new Exception("Unknown WSA image type: " + (object) type);
   }
 }
 private static extern void SetWSAImage(string image, PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale scale);
 private void ImageField(PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale scale, GUIContent label, int imageWidth, int imageHeight, ref string imagePath, ref Texture2D image)
 {
     if (imagePath == null)
     {
         imagePath = PlayerSettings.WSA.GetVisualAssetsImage(type, scale);
     }
     if ((image == null) && !string.IsNullOrEmpty(imagePath))
     {
         image = AssetDatabase.LoadAssetAtPath<Texture2D>(imagePath);
     }
     Texture2D assetObject = (Texture2D) EditorGUILayout.ObjectField(label, image, typeof(Texture2D), false, new GUILayoutOption[0]);
     string b = (assetObject == null) ? "" : AssetDatabase.GetAssetPath(assetObject);
     if (!string.Equals(imagePath, b) && (!string.IsNullOrEmpty(b) ? ValidateImage(b, imageWidth, imageHeight) : true))
     {
         Undo.RecordObject(this.m_SettingsEditor.serializedObject.targetObject, "Change WSA Visual Asset");
         PlayerSettings.WSA.SetVisualAssetsImage(b, type, scale);
         imagePath = b;
         image = assetObject;
     }
 }
        public void ToggleLogStackTraces(object userData)
        {
            StackTraceLogTypeData data = (StackTraceLogTypeData)userData;

            PlayerSettings.SetStackTraceLogType(data.logType, data.stackTraceLogType);
        }
 void capabilityToggle(PlayerSettings.WSACapability mCap,string tooltip)
 {
     PlayerSettings.WSA.SetCapability(mCap, GUILayout.Toggle(PlayerSettings.WSA.GetCapability(mCap), new GUIContent(" " + mCap.ToString(), tooltip)));
 }
        private void AddStackTraceLoggingMenu(GenericMenu menu)
        {
            // TODO: Maybe remove this, because it basically duplicates UI in PlayerSettings
            foreach (LogType logType in Enum.GetValues(typeof(LogType)))
            {
                foreach (StackTraceLogType stackTraceLogType in Enum.GetValues(typeof(StackTraceLogType)))
                {
                    StackTraceLogTypeData data;
                    data.logType           = logType;
                    data.stackTraceLogType = stackTraceLogType;

                    menu.AddItem(EditorGUIUtility.TrTextContent("Stack Trace Logging/" + logType + "/" + stackTraceLogType), PlayerSettings.GetStackTraceLogType(logType) == stackTraceLogType,
                                 ToggleLogStackTraces, data);
                }
            }

            int stackTraceLogTypeForAll = (int)PlayerSettings.GetStackTraceLogType(LogType.Log);

            foreach (LogType logType in Enum.GetValues(typeof(LogType)))
            {
                if (PlayerSettings.GetStackTraceLogType(logType) != (StackTraceLogType)stackTraceLogTypeForAll)
                {
                    stackTraceLogTypeForAll = -1;
                    break;
                }
            }

            foreach (StackTraceLogType stackTraceLogType in Enum.GetValues(typeof(StackTraceLogType)))
            {
                menu.AddItem(EditorGUIUtility.TrTextContent("Stack Trace Logging/All/" + stackTraceLogType), (StackTraceLogType)stackTraceLogTypeForAll == stackTraceLogType,
                             ToggleLogStackTracesForAll, stackTraceLogType);
            }
        }
Example #22
0
 public void ToggleLogStackTraces(object userData)
 {
     ConsoleWindow.StackTraceLogTypeData stackTraceLogTypeData = (ConsoleWindow.StackTraceLogTypeData)userData;
     PlayerSettings.SetStackTraceLogType(stackTraceLogTypeData.logType, stackTraceLogTypeData.stackTraceLogType);
 }
			public static bool GetCapability(PlayerSettings.WSACapability capability)
			{
				string text = PlayerSettings.WSA.InternalGetCapability(capability.ToString());
				if (string.IsNullOrEmpty(text))
				{
					return false;
				}
				bool result;
				try
				{
					result = (bool)TypeDescriptor.GetConverter(typeof(bool)).ConvertFromString(text);
				}
				catch
				{
					Debug.LogError(string.Concat(new string[]
					{
						"Failed to parse value  ('",
						capability.ToString(),
						",",
						text,
						"') to bool type."
					}));
					result = false;
				}
				return result;
			}