Class AvatarEquippableRegistry
Manages registration and loading of AvatarEquippable prefabs from AssetBundles. Allows modders to load AvatarEquippable prefabs and register them so they can be used with equippable items.
public static class AvatarEquippableRegistry
- Inheritance
-
AvatarEquippableRegistry
- Inherited Members
Remarks
This class now uses RuntimeResourceRegistry internally for asset registration.
Methods
GetRegisteredPrefab(string)
Gets a registered AvatarEquippable prefab.
public static GameObject GetRegisteredPrefab(string assetPath)
Parameters
assetPathstringThe Resources path.
Returns
- GameObject
The registered prefab, or null if not found.
IsRegistered(string)
Checks if an AvatarEquippable is registered at the given path.
public static bool IsRegistered(string assetPath)
Parameters
assetPathstringThe Resources path to check.
Returns
- bool
True if registered, false otherwise.
LoadAndRegisterFromBundle(WrappedAssetBundle, string, string)
Loads an AvatarEquippable prefab from an AssetBundle and registers it.
public static bool LoadAndRegisterFromBundle(WrappedAssetBundle bundle, string prefabName, string assetPath)
Parameters
bundleWrappedAssetBundleThe AssetBundle containing the prefab.
prefabNamestringThe name of the prefab asset in the bundle.
assetPathstringThe Resources path to register (e.g., "Equippables/MyItem").
Returns
- bool
True if loading and registration were successful.
LoadAndRegisterFromEmbeddedBundle(string, string, string, Assembly)
Loads an AvatarEquippable prefab from an embedded AssetBundle and registers it.
public static bool LoadAndRegisterFromEmbeddedBundle(string bundleName, string prefabName, string assetPath, Assembly assemblyOverride = null)
Parameters
bundleNamestringThe name of the embedded AssetBundle resource.
prefabNamestringThe name of the prefab asset in the bundle.
assetPathstringThe Resources path to register (e.g., "Equippables/MyItem").
assemblyOverrideAssemblyOptional assembly to load the bundle from. If null, uses executing assembly.
Returns
- bool
True if loading and registration were successful.
RegisterAvatarEquippable(string, GameObject)
Registers an AvatarEquippable prefab with a Resources path. After registration, the prefab can be loaded via Resources.Load using the provided assetPath.
public static bool RegisterAvatarEquippable(string assetPath, GameObject prefab)
Parameters
assetPathstringThe Resources path to register (e.g., "Equippables/MyItem").
prefabGameObjectThe AvatarEquippable prefab GameObject to register.
Returns
- bool
True if registration was successful.
Remarks
The prefab must have an AvatarEquippable component attached. Ensure the assetPath matches what you'll use in WithAvatarEquippable().