Creating & loading AssetBundles for ECC - LeeTwentyThree/ECCLibrary-Legacy GitHub Wiki
Editing Creating & loading AssetBundles for ECC
Overview
Asset bundles are created with Unity. They are used to import assets into the game. The AssetBundle must be made in a version of the Unity Editor that matches the version of Unity the game uses (with a bit of room for error). 2019.2.19f1
is the version of the Unity Editor that I use.
Creating an AssetBundle with a script
Insert here
Creating an AssetBundle with the AssetBundle Browser
https://docs.unity3d.com/Packages/[email protected]/manual/index.html
Creating AssetBundles for ECC
Things to keep in mind
- Ensure the AssetBundle has a unique name (for example not something like
assets
).- Ensure all assets to be used are included in the bundle.
- Tip: Tagging the "parent folder" of all your assets with an AssetBundle should include all files inside that folder in the built AssetBundle.
- All creatures should be prefabs. This creature requires a model and a collider at minimum. Rigidbodies and such will be added automatically.
- This page explains how to set up a creature prefab.
- Transparent and/or Cutout materials should have the word
Transparent
orCutout
in the name, respectively.- Example:
GhostLeviathanMaterial_Transparent.mat
.
- Example:
- All image files except "Scanner popups" should be imported as Texture2Ds.
- Scanner popups should be imported as Sprites.
- WARNING: Texture2Ds look much worse than Sprites. In the future, ECC may be converted to use Sprites instead. But for now, this is not the case. If you want, you can override the ECC methods to use sprites.
- When you are done, build the AssetBundle.
Including the AssetBundle in your mod folder
- Create a folder in your mod folder called
Assets
. - Place the built AssetBundle(s) inside the Assets folder.
- It is not necessary to place the
.manifest
folder in the Assets folder.- This text file contains a list of all asset paths.
Loading the AssetBundle
- Loading the AssetBundle is a simple task and is done by ECC for the most part.
- Add this line to your patch method:
yourAssetBundle = ECCHelpers.LoadAssetBundleFromAssetsFolder(Assembly.GetExecutingAssembly(), "the name of your asset bundle");
and replace theassetsFileName
parameter with the name of your AssetBundle file.
Multiple AssetBundles
Having multiple AssetBundles works perfectly fine.
There are some instances where you may want to consider having multiple AssetBundles:
- You want a downloadable, optional add-on for your mod.
- You have an AssetBundle from another modder or from the internet.
- Your mod is exceptionally large.
- Splitting an AssetBundle into multiple AssetBundles might increase overall filesize because how the compression works.
- HOWEVER doing this is a lot more organized than having one massive AssetBundle.
- This also helps because build times of larger AssetBundles can be extremely long.
- When you have a single AssetBundle and make a single change, you have to wait for that entire AssetBundle to reconstruct itself.
- When you have multiple AssetBundles and make a change, you only have to wait for one of the small AssetBundles to reconstruct itself.