public static void SelectMap(Action <string> returnAction) { TiledMapSelectorWindow window = CreateInstance <TiledMapSelectorWindow>(); window.returnAction = returnAction; window.ShowUtility(); }
bool DrawMapSelection() { bool foundFile = false; // Try loading mapdata from file try { // If everything is successful target.data = TiledMapData.Load(fullPath); EditorGUILayout.HelpBox("Using file: " + fullPath, MessageType.Info); foundFile = true; } catch (System.Exception) { // If the file can't be found EditorGUILayout.HelpBox("Can't find file: " + fullPath, MessageType.Error); } if (GUILayout.Button("Select File")) { // Lambda expression to avoid (redundant?) functions TiledMapSelectorWindow.SelectMap(x => target.relativePath = x); } return(foundFile); }