MRLE Extension - Save/Load file picker

Documentation for Unity Asset Store version MRLE v1.34 / Save/Load file picker v2.2

Summary

The file picker extension allows to save and load multiple level files. It contains a popup that allows you to enter a new file name or to pick a level from existing files. MRLE Extension - Save/Load file picker available in Unity Asset Store.

Upload levels to Steam Workshop

Use the single line of code below to activate Steam Workshop level database format. This code line should be executed on startup of your game, for example in the Awake method of your main script. Levels will be saved in a folder containing the level file and the icon. This is required by Steam, only folders can be uploaded to Steam Workshop. It is not possible to upload single files. LE_LevelEditor.Extensions.LE_ExtensionInterface.FileSelectionInstance.LevelDB = new LE_LevelEditor.Extensions.LE_LevelDatabase_SteamWorkshop(); Once this is done you can use the Steam Workshop - Easy Steamworks Integration to upload and download levels. Pass the Steam Workshop item root folder to the constructor of the LE_LevelDatabase_SteamWorkshop class if you want to load Workshop levels with the file picker menu. You can replace the LevelDB property whenever you want in your scripts. The example script below will allow the player to select a level and upload it: using System.IO;
using UnityEngine;

using LE_LevelEditor.Extensions;
using LE_LevelEditor.UI;
using LevelFile = LE_LevelEditor.Extensions.LE_ExtensionInterface.FileSelectionExtensionLoader.LevelFile;

using LapinerTools.Steam;
using LapinerTools.Steam.UI;
using LapinerTools.Steam.Data;

using LapinerTools.uMyGUI;

// Add this example script to your level editor scene.
// It will change the level folder structure of the saved levels to match Steam Workshop requirements.
// Press F1 while running the scene to upload a level.

public class MRLE_SteamWorkshop_ESI_Example : MonoBehaviour
{
   private void Awake()
   {
      LE_LevelEditor.Extensions.LE_ExtensionInterface.FileSelectionInstance.LevelDB = new LE_LevelEditor.Extensions.LE_LevelDatabase_SteamWorkshop();
   }
   
   void Update()
   {
      if (Input.GetKeyUp(KeyCode.F1))
      {
         LE_FileSelectionHelpers.SelectLevel(this, "Upload Level", "Which level do you want to upload to Steam Workshop?", (int p_selectedLevelIndex, LevelFile[] p_levelFiles)=>
            {

               // get Steam item from folder

               string levelFolder = Path.GetDirectoryName(p_levelFiles[p_selectedLevelIndex].PathData);
               WorkshopItemUpdate itemUpdate = SteamWorkshopMain.Instance.GetItemUpdateFromFolder(levelFolder);
               if (itemUpdate == null)
               {

                  // level was never uploaded => prefil the upload dialog

                  itemUpdate = new WorkshopItemUpdate();
                  itemUpdate.Name = p_levelFiles[p_selectedLevelIndex].Name;
                  itemUpdate.IconPath = p_levelFiles[p_selectedLevelIndex].PathIcon;
                  itemUpdate.ContentPath = levelFolder;
               }

               // show the Steam Workshop item upload popup

               ((SteamWorkshopPopupUpload)uMyGUI_PopupManager.Instance.ShowPopup("steam_ugc_upload")).UploadUI.SetItemData(itemUpdate);
            });
      }
   }
}