Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Command line argument
Browse files Browse the repository at this point in the history
Add argument to allow for users to load into sandbox on game start with -uk_construct or -sandbox
  • Loading branch information
Temperz87 committed Oct 2, 2022
1 parent 3f28334 commit e2aebb1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions UK Mod Manager/API/UKAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using UnityEngine;
using UMM.Loader;
using Newtonsoft.Json;
using UnityEngine.SceneManagement;

namespace UMM
{
Expand Down Expand Up @@ -76,6 +77,12 @@ internal static IEnumerator InitializeAPI()
bundles.Add("common", commonBundle);
Traverse.Create(MapLoader.Instance).Field("loadedBundles").SetValue(bundles);
MapLoader.Instance.isCommonLoaded = true;

string[] arr = Environment.GetCommandLineArgs(); // This is here to ensure that the common asset bundle is loaded correctly before loading a level
if (arr != null)
foreach (string str in arr)
if (str != null && (str.Contains("sandbox") || str.Contains("uk_construct")))
SceneManager.LoadScene("uk_construct");
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions UK Mod Manager/UltraModManager.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using BepInEx;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using UnityEngine;
using BepInEx;

namespace UMM.Loader
{
Expand Down

0 comments on commit e2aebb1

Please sign in to comment.