AssetBundleLoaderPlugin

v1.0.0·Updated 2021-06-03

Dependency plugin for other plugins which provides easy asset bundle loading on startup and runtime

About this mod Author’s original text

Asset Bundle Loader Plugin

This unofficial TaleSpire plugin is for providing easy AssetBundle loading at runtime

functionality. Supports both loading various AssetBundles on parent plugin startup and

loading AssetBundles on demand during runtime.

Change Log

1.0.0: Initial release

Install

Install using R2ModMan or similar. Reference the plugin DLL in the parent plugin projects and add

[BepInDependency(LordAshes.AssetBundleLoaderPlugin.Guid)]

`

to the plugin main (BaseUnityPlugin) class. This will allow the parent plugin to use the various

methods provided by this plugin which allow easy access to AssetBundle loading.

Typical Usage

[BepInPlugin(Guid, Name, Version)]

[BepInDependency(LordAshes.AssetBundleLoaderPlugin.Guid)]

public class AssetBundleExamplePlugin: BaseUnityPlugin

{

// Plugin info

public const string Name = "Asset Bundle Example Plug-In";

public const string Guid = "org.lordashes.plugins.assetbundleexample";

public const string Version = "1.0.0.0";

// Content directory

private string dir = UnityEngine.Application.dataPath.Substring(0, UnityEngine.Application.dataPath.LastIndexOf("/")) + "/TaleSpire_CustomData/";

void Awake()

{

// Load any Asset Bundles in the Manifest file that are marked as preload

LordAshes.AssetBundleLoaderPlugin.LoadManifest(dir+"Config/"+AssetBundleExamplePlugin.Guid+"/AssetBundles.json);

}

void Update()

{...

// Load an Asset Bundle specified in the Asset Bundle JSO Manifest file

LordAshes.AssetBundleLoaderPlugin.LoadAssetBundle("Pokemon");...

// Load an Asset Bundle not specified in the Asset Bundle JSO Manifest file

LordAshes.AssetBundleLoaderPlugin.LoadAssetBundle("Dragon", "D:/Steam/steamapps/common/TaleSpire/TaleSpire_CustomData/Minis/dragon/char_dragon_0000000001");...

// Create anm object from the prefab Dragon01 in the Assset Bundle associated with the unique name Dragon

GameObject go = GetPrefabInstance("Dragon", "Dragon01");

}

}

The Ways To Load

The plugin allow the following three different methods for loading AssetBundles at runtime...

AssetBundle Manifest

Code similar to the following can be used

LordAshes.AssetBundleLoaderPlugin.LoadManifest(manifestDirectory);

to load AssetBundle JSON Manifest file which associates AssetBundles with a unique name and

indicates if they should be preloaded. This method of loading AssetBundles is ideal when the

parent plugin knows which assetBundles are needed at startup. However, even if some AssetBundles

are known in advance but not necessarily loaded on startup, it can be advantageous to include

them in the manifest. The main advantage of using the manifest file is that the location of the

AssetBundle is defined in the manifest file as opposed to being hard coded in the plugin. This

means that the location can easily be modified as needed.

The name of the AssetBundle JSON file is always assetBundles.json but the LoadManifest()

method allows the specification of the manifest location. Typically this would be placed in

TaleSpire_CustomData/Config/{plugin Guid} where the plugin guid would be the guid of the

parent plugin so that each plugin can have its own AssetBundle manifest.

The contents of the assetBundles.json look...

{

"Android": { "source": "D:/Steam/steamapps/common/TaleSpire/TaleSpire_CustomData/Minis/AndroidV5/char_avdroidv5_0000000001", "preload": false},

"Kiki": { "source": "D:/Steam/steamapps/common/TaleSpire/TaleSpire_CustomData/Minis/lordashes/lordashes", "preload": true}

}

The key for each line is the unique name associated with the AssetBundle and is the name that will be used to access the AssetBundle in code.

The source property of the value indicates the full path and file name of the AssetBundle.

The preload property of the value indicates if the AssetBundle should be loaded when the LoadManifest method is called.

If the AssetBundle is not preloaded then it information is still stored and thus the AssetBundle can be loaded later using the unique name. See below.

In most cases th

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
  3. For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
  4. Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.

Install locations vary a lot between mods — the bundled readme is the most reliable guide.

Dependencies

Install these first, or the mod will not work:

bbepisTaleSpire-BepInExPackbrcoding-SetInjectionFlagPlugin

File & checksum

Filename
AssetBundleLoaderPlugin-1.0.0.zip
File size
28.3 KiB