예제 #1
0
        private void SetCompilerTarget(Compiler compiler)
        {
            m_Compiler.intValue = (int)compiler;

            m_Defines   = serializedObject.FindProperty("m_Defines");
            m_IsApplied = serializedObject.FindProperty("m_IsApplied");

            if (m_Compiler.intValue == (int)Compiler.Platform)
            {
                m_BuildTarget        = serializedObject.FindProperty("m_BuildTarget");
                m_CurrentTargetGroup = (BuildTargetGroup)m_BuildTarget.intValue;

                SetBuildTarget(m_CurrentTargetGroup == BuildTargetGroup.Unknown
                                        ? BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)
                                        : m_CurrentTargetGroup);
            }
            else
            {
                var defs = GlobalDefineUtility.GetDefines((Compiler)m_Compiler.intValue);

                m_Defines.arraySize = defs.Length;

                for (int i = 0; i < defs.Length; i++)
                {
                    m_Defines.GetArrayElementAtIndex(i).stringValue = defs[i];
                }

                m_IsApplied.boolValue = true;
                serializedObject.ApplyModifiedProperties();
            }
        }
예제 #2
0
        private void ApplyDefines()
        {
            string[] arr = new string[m_Defines.arraySize];

            for (int i = 0, c = arr.Length; i < c; i++)
            {
                arr[i] = m_Defines.GetArrayElementAtIndex(i).stringValue;
            }

            if (m_Compiler.intValue == (int)Compiler.Platform)
            {
                PlayerSettings.SetScriptingDefineSymbolsForGroup(m_CurrentTargetGroup, string.Join(";", arr));
            }
            else
            {
                GlobalDefineUtility.SetDefines((Compiler)m_Compiler.intValue, arr);
            }

            m_IsApplied.boolValue = true;

            serializedObject.ApplyModifiedProperties();

            GUI.FocusControl("");
        }