public override void OnInspectorGUI() { if (sectionsNames == null) { sectionsNames = new List <string>(); } sectionsNames.Clear(); for (int i = 1; i < data.sectionSettings.Count; i++) { sectionsNames.Add(data.sectionSettings[i].name); } GUILayoutElements.DrawHeader(data.name, GUIResources.GetMediumHeaderStyle_LG()); GUILayout.Space(10); GUILayout.BeginHorizontal(); if (GUILayout.Button("Add Section", GUIResources.Button_MD())) { data.AddSection(); } GUILayout.EndHorizontal(); GUILayout.Space(10); for (int i = 0; i < data.sectionSettings.Count; i++) { if (i == 0) { GUILayoutElements.DrawHeader( string.Format("{0}. {1}", i, data.sectionSettings[i].name), GUIResources.GetMediumHeaderStyle_MD() ); GUILayout.Space(5); continue; } GUILayout.BeginHorizontal(); GUILayoutElements.DrawHeader( data.sectionSettings[i].name, GUIResources.GetMediumHeaderStyle_MD(), GUIResources.GetLightHeaderStyle_MD(), ref data.sectionSettings[i].fold ); if (GUILayout.Button("X", GUILayout.Width(25), GUILayout.Height(25))) { data.sectionSettings.RemoveAt(i); i--; continue; } GUILayout.EndHorizontal(); if (data.sectionSettings[i].fold) { GUILayout.Space(5); DrawSectionSettings(data.sectionSettings[i], i); } GUILayout.Space(5); } GUILayout.Space(10); drawRawOption = EditorGUILayout.Toggle("Draw raw options", drawRawOption); if (drawRawOption) { base.OnInspectorGUI(); } if (data != null) { EditorUtility.SetDirty(data); } }
public override void OnInspectorGUI() { GUILayoutElements.DrawHeader(data.name, GUIResources.GetMediumHeaderStyle_LG()); scroll = GUILayout.BeginScrollView(scroll); GUILayout.Space(10); if (GUILayoutElements.DrawHeader( "Basic options", GUIResources.GetMediumHeaderStyle_MD(), GUIResources.GetLightHeaderStyle_MD(), ref this.data.basicOptionsFold )) { DrawBasicOptions(); } GUILayout.Space(5); if (GUILayoutElements.DrawHeader( "Sections", GUIResources.GetMediumHeaderStyle_MD(), GUIResources.GetLightHeaderStyle_MD(), ref data.sectionFold )) { DrawSections(); } GUILayout.Space(5); if (GUILayoutElements.DrawHeader( "Data type options", GUIResources.GetMediumHeaderStyle_MD(), GUIResources.GetLightHeaderStyle_MD(), ref data.additionalOptionsFold )) { DrawTypeInfo(); } GUILayout.Space(5); if (GUILayoutElements.DrawHeader( "Contact Points", GUIResources.GetMediumHeaderStyle_MD(), GUIResources.GetLightHeaderStyle_MD(), ref data.contactPointsFold )) { DrawContactPoints(); } GUILayout.EndScrollView(); GUILayout.Space(20); drawRawOptions = EditorGUILayout.Toggle(new GUIContent("Draw raw options"), drawRawOptions); if (drawRawOptions) { base.OnInspectorGUI(); } if (data != null) { EditorUtility.SetDirty(data); } }