/// <summary> /// Returns TRUE if the given global define is present in all the <see cref="T:UnityEditor.BuildTargetGroup" /> /// or only in the given <see cref="T:UnityEditor.BuildTargetGroup" />, depending on passed parameters.<para /> /// </summary> /// <param name="id"></param> /// <param name="buildTargetGroup"><see cref="T:UnityEditor.BuildTargetGroup" />to use. Leave NULL to check in all of them.</param> public static bool HasGlobalDefine(string id, BuildTargetGroup?buildTargetGroup = null) { BuildTargetGroup[] buildTargetGroupArray; if (buildTargetGroup.HasValue) { buildTargetGroupArray = new BuildTargetGroup[1] { buildTargetGroup.Value } } ; else { buildTargetGroupArray = (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup)); } foreach (BuildTargetGroup buildTargetGroup1 in buildTargetGroupArray) { if (EditorUtils.IsValidBuildTargetGroup(buildTargetGroup1)) { if (Array.IndexOf <string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup1).Split(';'), id) != -1) { return(true); } } } return(false); }
/// <summary> /// Adds the given global define if it's not already present /// </summary> public static void AddGlobalDefine(string id) { bool flag = false; int num = 0; foreach (BuildTargetGroup buildTargetGroup in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup))) { if (EditorUtils.IsValidBuildTargetGroup(buildTargetGroup)) { string defineSymbolsForGroup = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup); if (Array.IndexOf <string>(defineSymbolsForGroup.Split(';'), id) == -1) { flag = true; ++num; string defines = defineSymbolsForGroup + (defineSymbolsForGroup.Length > 0 ? ";" + id : id); PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, defines); } } } if (!flag) { return; } Debug.Log((object)string.Format("DOTween : added global define \"{0}\" to {1} BuildTargetGroups", (object)id, (object)num)); }
/// <summary>Removes the given global define if it's present</summary> public static void RemoveGlobalDefine(string id) { bool flag = false; int num = 0; foreach (BuildTargetGroup buildTargetGroup in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup))) { if (EditorUtils.IsValidBuildTargetGroup(buildTargetGroup)) { string[] array = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup).Split(';'); if (Array.IndexOf <string>(array, id) != -1) { flag = true; ++num; EditorUtils._Strb.Length = 0; for (int index = 0; index < array.Length; ++index) { if (!(array[index] == id)) { if (EditorUtils._Strb.Length > 0) { EditorUtils._Strb.Append(';'); } EditorUtils._Strb.Append(array[index]); } } PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, EditorUtils._Strb.ToString()); } } } EditorUtils._Strb.Length = 0; if (!flag) { return; } Debug.Log((object)string.Format("DOTween : removed global define \"{0}\" from {1} BuildTargetGroups", (object)id, (object)num)); }