UKAPI - Temperz87/ultra-mod-manager GitHub Wiki
UKAPI is the API that is exposed through the UMM namespace and has some niche uses. If you want to see what UKMod exposes, check out the corresponding page. All methods in this page can be accessed by through the static class UKAPI
.
Common Asset Bundle
ULTRAKILL tries to load an asset bundle at runtime, located at "ULTRAKILL\ULTRAKILL_Data\StreamingAssets\common", which stores most of the game's assets. Due to ULTRAKILL continuously keeping this bundle loaded, it can be hard to access the contents of it. UMM exposes two methods that load from this bundle.
public static object LoadCommonAsset(string name)
Tries to load an Ultrakill asset from "ULTRAKILL_Data/StreamingAssets/common", note that name
must include a file extension (i.e. .prefab, .asset).
Returns an asset from the common asset bundle if found, otherwise null.
public static AssetBundleRequest LoadCommonAssetAsync(string name)
Tries to create a Ultrakill asset load request from ULTRAKILL_Data/StreamingAssets/common, note that this request must be awaited, and must include a file extension on name
(i.e. .prefab .asset).
Returns a new AssetBundleRequest
for your item.
Cybergrind Submission
Some mod authors might make mods that affect the Cybergrind experience in an unfair way, and as such UMM offers ways for said authors to disable/enable Cybergrind score submission through a reason system.
public static void DisableCyberGrindSubmission(string reason)
Disables Cybergrind score submissions, provided a reason
to disable them. Note that these reasons are stored in a list, note that if the list already contains said reason
it will not be added.
public static void RemoveDisableCyberGrindReason(string reason)
Removes a Cybergrind disable reason
if found, Cybergrind score submissions will only be enabled if there aren't any reasons to disable it.
public static bool CanSubmitCybergrindScore
Checks if Cybergrind score submissions are enabled (if there are 0 reasons to disable Cybergrind score submissions).
Keybinds
UMM allows for mod creators to make custom keybinds using the UKKeyBind
class. Keybinds are stored by name only, so if multiple mods use have a keybind with the same name, they'll all be tied to the same bind.
public static UKKeyBind GetKeyBind(string key, KeyCode fallback = KeyCode.None)
Gets a UKKeyBind
given its name, if the keybind doesn't exist it will be created.
public static bool EnsureKeyBindExists(string key)
Ensures that UKKeyBind exists given a key, if it doesn't exist it won't be created.
UKKeyBind
This is the class that is associated with keybinds in UMM. note that it inherits from InputActionState
, meaning it has fields like isPressed
.
public KeyCode keyBind
Gets the KeyCode associated with the keybind.
public string bindName
Gets the name associated with the bind.
public UnityEvent onPress = new UnityEvent()
A UnityEvent that fires when the button is pressed.
public UnityEvent onPerformInScene = new UnityEvent()
A UnityEvent that fires when the button is pressed and the player is in a playable scene.
public bool IsPressedInScene
Gets whether or not the keybind is pressed and the player is in a playable scene.
public bool WasPerformedThisFrameInScene
Gets whether or not the keybind was pressed in this frame and the player is in a playable scene.
public BindingChangedEvent OnBindingChanged = new BindingChangedEvent();
Fires when the bindings keycode changes, supplies a KeyCode.
public void ChangeKeyBind(KeyCode bind)
Changes the keybind's key given a KeyCode.
Level context helper
UMM offers ways for mod authors to tell what type of scene they're in, and fire functions when a certain scene is entered.
public enum UKLevelType { Intro, MainMenu, Level, Endless, Sandbox, Custom, Intermission, Unknown }
The enum that represents a level type.
public static UKLevelType CurrentLevelType = UKLevelType.Intro
The current UKLevelType
that is loaded.
public static OnLevelChangedHandler OnLevelChanged
A delegate that is invoked whenever the level changes.
public static OnLevelChangedHandler OnLevelTypeChanged
A delegate that is invoked only when the level type has changed.
public delegate void OnLevelChangedHandler(UKLevelType uKLevelType)
A delegate that is invoked only when the level type has changed, and supplies a UKLevelType
as a parameter.
public static bool InLevel()
A bool that returns true when the player is in a playable scene (e.g. 4-2, but not intermissions).
public static UKLevelType GetUKLevelType(string sceneName)
Gets the enumerated level type from the name of a scene, provided a sceneName
.
Miscellaneous
public static void Restart()
Restarts ULTRAKILL using Steam.
public static Dictionary<string, ModInformation> AllModInfoClone
Returns a dictionary of all ModInformation
of found mods, with the mods GUID
as the key and ModInformation
as the value, even if they aren't loaded.
public static Dictionary<string, ModInformation> AllLoadedModInfoClone
Returns a list of all ModInformation
of loaded mods, with the mods GUID
as the key and ModInformation
as the value.