Steven-Slime_Modding_Utilities icon

Slime Modding Utilities

A utility mod that provides common functionality for modders.

Last updated 3 years ago
Total downloads 2989
Total rating 2 
Categories Mods
Dependency string Steven-Slime_Modding_Utilities-1.0.0
Dependants 5 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack_NASB-5.4.16 icon
BepInEx-BepInExPack_NASB

BepInEx pack for Nickelodeon All-Star Brawl. Preconfigured and ready to use.

Preferred version: 5.4.16

README

Slime Modding Utilities (SMU)

A utility mod for Nickelodeon All Star Brawl. This mod does nothing on its own, but has a bunch of nifty features that modders can make use of.


SMU.Events

Contains handy extension methods for safely firing off events, without the worry of an exception stopping the chain.

public static void InvokeAll(this Action action, params object[] args)

SMU.Constants

Contains methods to translate character and stage IDs into their human-readable names, and vice versa.

public static bool TryGetIdFromName(string name, out string id);
public static string GetIdFromName(string name);
public static bool TryGetNameFromId(string id, out string name);
public static string GetNameFromId(string id);
public static List<string> GetCharacterIds();
public static List<string> GetStageIds();

SMU.Reflection

Contains handy extension methods to help get and set private fields and properties, invoke private methods, and copy Unity components.

public static U GetField<T, U>(this T obj, string fieldName);
public static U GetProperty<T, U>(this T obj, string propertyName);
public static void SetField<T, U>(this T obj, string fieldName, U value);
public static void SetProperty<T, U>(this T obj, string propertyName, U value);
public static T InvokeMethod<T>(this object obj, string methodName, params object[] args);
public static Component CopyComponent(this Component original, Type overridingType,
                                      GameObject destination, Type originalTypeOverride = null);

SMU.Utilities

Contains extra utility classes with miscellaneous functionality

  • ImageHelper
    • Utility class for loading external images from various locations; creates Texture2D and Sprite objects
    public static Texture2D LoadTextureRaw(byte[] bytes);
    public static Texture2D LoadTextureFromFile(string path);
    public static Texture2D LoadTextureFromResources(string resourcePath);
    public static Sprite LoadSpriteRaw(byte[] image, float pixelsPerUnit = 100.0f);
    public static Sprite LoadSpriteFromTexture(Texture2D texture, float pixelsPerUnit = 100.0f);
    public static Sprite LoadSpriteFromFile(string path, float pixelsPerUnit = 100.0f);
    public static Sprite LoadSpriteFromResources(string resourcePath, float pixelsPerUnit = 100.0f);
    
  • SharedCoroutineStarter
    • Provides a way to start coroutines from any class, without having to derive from MonoBehaviour
    public static new Coroutine StartCoroutine(IEnumerator routine);