Appearance
Asset Bundles
Introduction
Asset Bundles are files that contain unity assets like sprites, audio and more.
Custom charms, weapons, levels, and most of Blender's features use them in a way.
Creating them requires installing Unity v2017.3.0.
Set up the project
INFO
This is a one time process, you won't have to do it again.
- In the unity hub, create a new 2D project and open it.
- Create
Scripts\Editordirectories inside of your project'sAssets. - Inside of the
Editordirectory, create a script calledBundleGenthat will contain the following code:
cs
using UnityEngine;
using UnityEditor;
using System.IO;
public class BundleGen
{
[MenuItem("Assets/Generate Bundles %G")]
private static void GenerateBundles()
{
string dirPath = "Assets/StreamingAssets";
if (!Directory.Exists(Application.streamingAssetsPath))
Directory.CreateDirectory(dirPath);
BuildPipeline.BuildAssetBundles(dirPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
}
}Creating the assets
- Bring your asset to
Assetsif it isn't there already. Click on the asset to view it in the inspector:
- In the bottom of the inspector, click on the
AssetBundledropdown and click onNewto name your new bundle. - You can add all of the assets you want to the new bundle, and then use the shortcut
Ctrl+Gto generate your bundles. - Go to your project in file explorer and go to the
Assets\StreamingAssetsdirectory, you can now grab the generated asset bundle. - Go to the directory where your mod is installed and create a new
Assetsdirectory in there, put the asset bundle there.