static void OnContextItem(MenuCommand command, SelectionMode mode) { GameObject[] selection = null; if (command == null || command.context == null) { // We were actually invoked from the top GameObject menu, so use the selection. selection = Selection.GetFiltered <GameObject>(mode); } else { // We were invoked from the right-click menu, so use the context of the context menu. var selected = command.context as GameObject; if (selected) { selection = new GameObject[] { selected }; } } if (selection == null || selection.Length == 0) { ModelExporter.DisplayNoSelectionDialog(); return; } Selection.objects = CreateInstantiatedModelPrefab(selection); }