Table of Contents

Class AssetBundleTemplate

Namespace
Nautilus.Assets.PrefabTemplates
Assembly
Nautilus.dll
A PrefabTemplate used for loading objects in from asset bundles
public class AssetBundleTemplate : PrefabTemplate
Inheritance
AssetBundleTemplate
Inherited Members
Extension Methods

Constructors

AssetBundleTemplate(string, string, PrefabInfo, Assembly)

Instantiates a new AssetBundleTemplate. Automatically loads the bundle by calling LoadFromAssetsFolder(Assembly, string), which expects the bundle to be in your mod's Assets folder.

Also caches the loaded bundle for future use.

If you are loading and using your bundle on your own, it's highly recommended to use the AssetBundle constructor overload instead.

Bundles are cached per Assembly, and won't work with mods that use multiple seperate bundles.

public AssetBundleTemplate(string assetBundleFileName, string prefabName, PrefabInfo info, Assembly modAssembly = null)

Parameters

assetBundleFileName string
The file name of the asset bundle. These often do not have file extensions.
prefabName string
The name of the prefab GameObject to load from the bundle.
info PrefabInfo
The prefab info to base this template off of.
modAssembly Assembly
The Assembly of the mod that contains the given Asset Bundle. If left unassigned, this will be automatically set to GetCallingAssembly().

AssetBundleTemplate(AssetBundle, string, PrefabInfo)

Instantiates a new AssetBundleTemplate
public AssetBundleTemplate(AssetBundle bundle, string prefabName, PrefabInfo info)

Parameters

bundle AssetBundle
The AssetBundle to load the asset from
prefabName string
The name of the prefab game object to load from the bundle
info PrefabInfo
The prefab info to base this template off of.

Properties

Prefab

A reference to the loaded prefab for modification purposes. This points directly to the prefab contained in the Asset Bundle.
public GameObject Prefab { get; }

Property Value

GameObject

Methods

GetPrefabAsync(TaskResult<GameObject>)

Gets a prefab of this template type. The returned object can be accessed via TaskResult<T>.Get().
public override IEnumerator GetPrefabAsync(TaskResult<GameObject> gameObject)

Parameters

gameObject TaskResult<GameObject>
The prefab computation result is set into this argument.
If the provided task result already has a game object set to it, it will try to set the necessary components first. Otherwise; sets a default implementation of this entity type.

Returns

IEnumerator
A coroutine operation. Must be used with either yield return, or StartCoroutine(IEnumerator).