Пример #1
0
        private static void InitializeOnLoad()
        {
            if (Instance == null)
            {
                return;
            }

            EditorApplication.playModeStateChanged += PlayModeStateChanged;

            // Recording defines before we possibly alter them
            List <string> definesBefore = new List <string>();

            BuildTargetGroupUtil.GetValid().ForEach(x => definesBefore.Add(PlayerSettings.GetScriptingDefineSymbolsForGroup(x)));

            EditorAppConfigDefinesHelper.UpdateProjectDefines();

            var activeConfig = ActiveAppConfig;

            foreach (var settings in GetActiveConfigSettings())
            {
                settings.InitializeOnLoad(activeConfig);
            }

            // Recording defines after we've possibly altered them
            List <string> definesAfter = new List <string>();

            BuildTargetGroupUtil.GetValid().ForEach(x => definesAfter.Add(PlayerSettings.GetScriptingDefineSymbolsForGroup(x)));

            // checking to see if the scripting defines have changed
            bool forceRecompile = definesBefore.Count != definesAfter.Count;

            if (forceRecompile == false)
            {
                for (int i = 0; i < definesBefore.Count; i++)
                {
                    if (definesBefore[i] != definesAfter[i])
                    {
                        forceRecompile = true;
                        break;
                    }
                }
            }

            if (forceRecompile)
            {
                // TODO [bgish]: Is this neccessary, if so implement
            }

            WriteRuntimeConfigFile();

            // TODO [bgish]: Write out the MenuItems class? (force recompile if new)
        }
Пример #2
0
        public static void UpdateProjectDefines(HashSet <string> definesToAdd, HashSet <string> definesToRemove)
        {
            foreach (var buildTargetGroup in BuildTargetGroupUtil.GetValid())
            {
                string currentDefinesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
                string definesString        = GetDefinesString(buildTargetGroup, definesToAdd, definesToRemove);

                if (currentDefinesString != definesString)
                {
                    PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, definesString);
                }
            }
        }