public override void OnInspectorGUI() { DrawDefaultInspector(); floorplanComponent componentScript = (floorplanComponent)target; if (GUILayout.Button("Convert to Wall")) { componentScript.ChangeComponentType(componentScript.tileset.wallTile); } if (GUILayout.Button("Convert to Arch")) { componentScript.ChangeComponentType(componentScript.tileset.archTile); } if (GUILayout.Button("Convert to Window")) { componentScript.ChangeComponentType(componentScript.tileset.windowTile); } }
public override void OnInspectorGUI() { //DrawDefaultInspector(); script = (floorplanComponent)target; if (EditorGUILayout.DropdownButton(new GUIContent("Tile type"), FocusType.Passive)) { GenericMenu menu = new GenericMenu(); foreach (TileTypes tileType in (TileTypes[])Enum.GetValues(typeof(TileTypes))) { if (tileType == TileTypes.None) { continue; } foreach (GameObject tile in script.getTilesFromType(tileType)) { menu.AddItem(new GUIContent(tileType.ToString() + "/" + tile.name), false, TileTypeChange, tile); } } menu.ShowAsContext(); } }