Show / Hide Table of Contents

Class AssetManager

Manager to handle interactions with the vanilla asset system, called SoftReferenceableAssets. See the Vanilla FAQ for more information.
Inheritance
object
AssetManager
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Jotunn.Managers
Assembly: Jotunn.dll
Syntax
public class AssetManager

Properties

Name Description
Instance The singleton instance of this manager.

Methods

Name Description
AddAsset(Object) Registers a new asset and generates a unique AssetID.
Assets can be added at any time and will be registered as soon as the vanilla loader is ready.
AddAsset(Object, Object) Registers a new asset with the same asset dependencies as the original asset and generates a unique AssetID.
Assets can be added at any time and will be registered as soon as the vanilla loader is ready.
ClonePrefab(GameObject, string, Transform) Clones a prefab and registers it in the SoftReference system with the same dependencies as the original asset
GenerateAssetID(string) Generates a unique AssetID, from a given string
GenerateAssetID(Object) Generates a unique AssetID, based on the asset name
GetAssetID(Type, string) Finds the AssetID by an asset name at runtime.
The closed matching base type must be used. E.g. for prefabs use GameObject, for Textures use Texture2D etc.
If no asset is found, an invalid AssetID is returned.
GetAssetID<T>(string) Finds the AssetID by an asset name at runtime.
The closed matching base type must be used. E.g. for prefabs use GameObject, for Textures use Texture2D etc.
If no asset is found, an invalid AssetID is returned.
GetSoftReference(Type, string) Finds the AssetID by an asset name at runtime and returns a SoftReference to the asset.
GetSoftReference<T>(string) Finds the AssetID by an asset name at runtime and returns a SoftReference to the asset.
IsReady() Checks if the vanilla loader is ready. If false, SoftReferenceableAssets.Runtime.Loader must not be accessed and no assets may be loaded. If the vanilla loader is initialized too early, mods can become incompatible.
ResolveMocksOnLoad(AssetID) Registers an asset to be instantiated and have its mock references resolved on load.
Must be called before the asset is loaded the first time.
ResolveMocksOnLoad(AssetID, Transform) Registers an asset to be instantiated under the given parent and have its mock references resolved on load.
Must be called before the asset is loaded the first time.
ResolveMocksOnLoad(AssetID, Transform, Action<Object>) Registers an asset to be instantiated under the given parent and have its mock references resolved on load.
Must be called before the asset is loaded the first time.
The callback will be invoked when the asset is already resolved and instantiated. Multiple callbacks can be registed for the same asset.
ResolveMocksOnLoad<T>(SoftReference<T>, Transform, Action<T>) Registers an asset to be instantiated under the given parent and have its mock references resolved on load.
Must be called before the asset is loaded the first time.
The callback will be invoked when the asset is already resolved and instantiated. Multiple callbacks can be registed for the same asset.

Events

Name Description
OnSoftReferenceableAssetsReady Event that is invoked when the soft referenceable system is ready to be used.

Extension Methods

PrefabExtension.FixReferences(object)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Generated by DocFX
☀
☾