public UtilityPolePlantEditor(ScriptableObject editor) { data = null; savedTool = Tool.None; pole = new RegistedObjectsHolder(); cable = new RegistedObjectsHolder(); planter = new UtilityPolePlanter(); data = getScript(editor); pole = new RegistedObjectsHolder(data.poles); cable = new RegistedObjectsHolder(data.cablesets); }
void selectImageGui(ref RegistedObjectsHolder target) { GUILayout.BeginVertical(GUI.skin.box); var style = new GUIStyle(GUI.skin.button); style.alignment = TextAnchor.UpperCenter; style.clipping = TextClipping.Overflow; style.imagePosition = ImagePosition.ImageAbove; style.fixedHeight = 96.0f; target.selectedId = GUILayout.SelectionGrid(target.selectedId, target.images, 4, style); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(GUI.skin.button); target.newSelected = (GameObject)EditorGUILayout.ObjectField("Add", target.newSelected, typeof(GameObject), false); GUILayout.EndVertical(); if (target.newSelected) { target.addSelected(); EditorUtility.SetDirty(data); } if (GUILayout.Button("Remove")) { target.removeSeleted(); EditorUtility.SetDirty(data); } GUILayout.EndHorizontal(); }