void OnGUI() { if (window == null) { Init(); } List <UnitCreep> creepList = EditorDBManager.GetCreepList(); if (GUI.Button(new Rect(window.position.width - 120, 5, 100, 25), "Save")) { EditorDBManager.SetDirtyCreep(); } EditorGUI.LabelField(new Rect(5, 7, 150, 17), "Add new creep:"); UnitCreep newCreep = null; newCreep = (UnitCreep)EditorGUI.ObjectField(new Rect(100, 7, 140, 17), newCreep, typeof(UnitCreep), false); if (newCreep != null) { int newSelectID = EditorDBManager.AddNewCreep(newCreep); if (newSelectID != -1) { SelectCreep(newSelectID); } } float startX = 5; float startY = 50; float cachedY = 50; if (minimiseList) { if (GUI.Button(new Rect(startX, startY - 20, 30, 18), ">>")) { minimiseList = false; } } else { if (GUI.Button(new Rect(startX, startY - 20, 30, 18), "<<")) { minimiseList = true; } } Vector2 v2 = DrawUnitList(startX, startY, creepList); startX = v2.x + 25; if (creepList.Count == 0) { return; } cont = new GUIContent("Creep Prefab:", "The prefab object of the creep\nClick this to highlight it in the ProjectTab"); EditorGUI.LabelField(new Rect(startX, startY, width, height), cont); EditorGUI.ObjectField(new Rect(startX + 90, startY, 185, height), creepList[selectID].gameObject, typeof(GameObject), false); startY += spaceY + 10; Rect visibleRect = new Rect(startX, startY, window.position.width - startX - 10, window.position.height - startY - 5); Rect contentRect = new Rect(startX, startY, contentWidth, contentHeight); //~ GUI.color=new Color(.8f, .8f, .8f, 1f); //~ GUI.Box(visibleRect, ""); //~ GUI.color=Color.white; scrollPos2 = GUI.BeginScrollView(visibleRect, scrollPos2, contentRect); UnitCreep creep = creepList[selectID]; v3 = DrawUnitConfigurator(startX, startY, creepList, creep.type == _CreepType.Offense); contentWidth = v3.z; contentHeight = v3.y; startX += spaceX + width + 45; startY += 75; if (creep.type != _CreepType.Default) { v3 = DrawStat(creep.stats[0], startX, startY, statContentHeight, creepList[selectID]); statContentHeight = v3.z; if (contentHeight < v3.y) { contentHeight = v3.y; } if (contentWidth < 530) { contentWidth = 530; } } contentHeight -= cachedY; GUI.EndScrollView(); if (GUI.changed) { EditorDBManager.SetDirtyCreep(); } }