protected virtual void OnGUI() { #if PROFILE Profiler.BeginSample(targetType.Name + " OnInspectorGUI"); Profiler.BeginSample(targetType.Name + " Header"); #endif if (ShowScriptHeader) { var scriptKey = RuntimeHelper.CombineHashCodes(id, "script".GetHashCode()); gui.Space(3f); using (gui.Horizontal(EditorStyles.toolbarButton)) { gui.Space(10f); foldouts[scriptKey] = gui.Foldout(foldouts[scriptKey]); gui.Space(-12f); if (ScriptField()) // script changed? exit! { return; } } if (foldouts[scriptKey]) { gui.Space(2f); using (gui.Indent(GUI.skin.textField)) { gui.Space(3f); if (targetType.IsDefined <HasRequirementsAttribute>()) { using (gui.Horizontal()) { gui.Space(3f); if (gui.MiniButton("Resolve Requirements", (Layout)null)) { Requirements.Resolve(target, gameObject); } } } gui.Member(_debug); var mask = gui.BunnyMask("Display", _display); { var newValue = (MembersDisplay)mask; if (_display != newValue) { _display = newValue; var displayKey = RuntimeHelper.CombineHashCodes(id, "display"); prefs.Ints[displayKey] = mask; } } var spacing = Mathf.Clamp(gui.Int("Spacing", _spacing), -13, (int)EditorGUIUtility.currentViewWidth / 4); if (_spacing != spacing) { _spacing = spacing; prefs.Ints[id + "spacing".GetHashCode()] = _spacing; gui.RequestResetIfRabbit(); } gui.Member(_serializationData, true); } } } #if PROFILE Profiler.EndSample(); #endif gui.BeginCheck(); #if PROFILE Profiler.BeginSample(targetType.Name + " Members"); #endif for (int i = 0; i < _categories.Count; i++) { var cat = _categories[i]; cat.Display = _display; cat.Spacing = _spacing; cat.gui = gui; cat.HideHeader = (_display & MembersDisplay.Headers) != MembersDisplay.Headers; if ((_display & MembersDisplay.CategorySplitter) != 0) { gui.Splitter(); } cat.Draw(target); } #if PROFILE Profiler.EndSample(); #endif if (gui.HasChanged()) { //Log("setting dirty " + target); EditorUtility.SetDirty(target); } #if PROFILE Profiler.EndSample(); #endif }