Table of Contents

Class RuntimeResourceRegistry

Namespace
S1API.Rendering
Assembly
S1API.dll

Provides runtime registration of Unity Resources that can be loaded via Resources.Load. This allows mods to inject custom assets without modifying Unity asset bundles.

public static class RuntimeResourceRegistry
Inheritance
RuntimeResourceRegistry
Inherited Members

Methods

GetRegisteredAsset(string)

Gets a registered asset.

public static Object? GetRegisteredAsset(string resourcePath)

Parameters

resourcePath string

The Resources path.

Returns

Object

The registered asset, or null if not found.

GetRegisteredAsset<T>(string)

Gets a registered asset of a specific type.

public static T? GetRegisteredAsset<T>(string resourcePath) where T : Object

Parameters

resourcePath string

The Resources path.

Returns

T

The registered asset cast to type T, or null if not found or wrong type.

Type Parameters

T

The type of asset to retrieve.

IsRegistered(string)

Checks if an asset is registered at the given path.

public static bool IsRegistered(string resourcePath)

Parameters

resourcePath string

The Resources path to check.

Returns

bool

True if registered, false otherwise.

RegisterAsset(string, Object)

Registers an asset with a Resources path. After registration, the asset can be loaded via Resources.Load using the provided path.

public static bool RegisterAsset(string resourcePath, Object asset)

Parameters

resourcePath string

The Resources path (e.g., "MyMod/Accessories/CustomHat").

asset Object

The Unity Object to register.

Returns

bool

True if registration was successful.

RegisterAssetForType(string, Object, Type)

Registers an asset with a Resources path for a specific type. This allows a single path to return different assets based on the requested type.

public static bool RegisterAssetForType(string resourcePath, Object asset, Type forType)

Parameters

resourcePath string

The Resources path.

asset Object

The Unity Object to register.

forType Type

The type this asset should be returned for.

Returns

bool

True if registration was successful.

RegisterGameObject(string, GameObject)

Registers a GameObject asset with a Resources path.

public static bool RegisterGameObject(string resourcePath, GameObject gameObject)

Parameters

resourcePath string

The Resources path.

gameObject GameObject

The GameObject to register.

Returns

bool

True if registration was successful.