private void SetCompilerTarget(Compiler compiler) { _compiler.intValue = (int)compiler; _defines = serializedObject.FindProperty("_defines"); _isApplied = serializedObject.FindProperty("_isApplied"); if (_compiler.intValue == (int)Compiler.Platform) { _buildTarget = serializedObject.FindProperty("_buildTarget"); _currentTargetGroup = (BuildTargetGroup)_buildTarget.intValue; SetBuildTarget(_currentTargetGroup == BuildTargetGroup.Unknown ? BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget) : _currentTargetGroup); } else { var defs = GlobalDefineUtility.GetDefines((Compiler)_compiler.intValue).ToList(); _defines.arraySize = defs.Count; for (var i = 0; i < defs.Count; i++) { _defines.GetArrayElementAtIndex(i).stringValue = defs[i]; } _isApplied.boolValue = true; serializedObject.ApplyModifiedProperties(); } }
private void ApplyDefines() { var arr = new string[_defines.arraySize]; for (int i = 0, c = arr.Length; i < c; i++) { arr[i] = _defines.GetArrayElementAtIndex(i).stringValue; } if (_compiler.intValue == (int)Compiler.Platform) { PlayerSettings.SetScriptingDefineSymbolsForGroup(_currentTargetGroup, string.Join(";", arr)); } else { GlobalDefineUtility.SetDefines((Compiler)_compiler.intValue, arr); } _isApplied.boolValue = true; serializedObject.ApplyModifiedProperties(); GUI.FocusControl(""); }