123456789101112131415161718192021222324252627282930313233343536 |
- using UnityEditor;
- using System.Collections.Generic;
- using System.Linq;
- namespace NRKernal.Release
- {
- static class DefineSymbolsUtility
- {
- public static bool HasSymbol(string symbol)
- {
- string definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
- return (!string.IsNullOrEmpty(definesString) && definesString.Contains(symbol));
- }
- public static void RemoveSymbol(string symbol)
- {
- string definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
- List<string> allDefines = definesString.Split(';').ToList();
- allDefines.Remove(symbol);
- PlayerSettings.SetScriptingDefineSymbolsForGroup(
- EditorUserBuildSettings.selectedBuildTargetGroup,
- string.Join(";", allDefines.ToArray()));
- }
- public static void AddSymbol(string symbol)
- {
- string definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
- List<string> allDefines = definesString.Split(';').ToList();
- List<string> Symbols = new List<string>() { symbol };
- allDefines.AddRange(Symbols.Except(allDefines));
- PlayerSettings.SetScriptingDefineSymbolsForGroup(
- EditorUserBuildSettings.selectedBuildTargetGroup,
- string.Join(";", allDefines.ToArray()));
- }
- }
- }
|