How to create and use Asset Bundles - piotrulos/MSCModLoader GitHub Wiki
Asset bundles allow you to import unity prefabs into you mods, this will save you some time for more complex objects.
This tutorial is only how to create and import asset bundles, if you want some tutorial for unity engine itself, this is not place for you.
Best way to start with unity is official documentation (click here for version 5.0)
-
Unity 5.0.0f4 (32-bit) or (64-bit) (current unity used in game, kinda old but still can download from archive, go to unity 5.x and scroll all way to bottom) or use Direct Download Link or This one
NOTE: The old unity licensing system is broken, you first need to install unity 5.6.7f1, then launch it directly (from desktop shortcut, not unity hub) and go through the license activation, then create a project and open it. Then you should be able to use 5.0.0f4. - Download
MSC_AssetBundle_Template.unitypackagefile from Releases
- Install unity 5.0.0f4 (Other newer versions will NOT work)
- Create new Project
- Double-click
MSC_AssetBundle_Template.unitypackageand import it to your project - Create some prefab (with everything you need, complex objects, animations, etc.)
- Select created prefab, and on bottom left you should have AssetBundle
- Click on first
Noneand selectNew...
- Name it for example
something.unity3dand press enter
- Add more things (prefabs,textures,sounds) that you need by just selecting "None" and then name of your bundle
something.unity3d
- If you are done, press anywhere right mouse button, or from top menu select
Assetsand clickBuild AssetBundles
- Wait to finish, and go to your project root folder (you can go there by
right click>Show in explorer)
- Go to folder called
AssetBundlesand grab your filesomething.unity3dthis is file you only need (ignore other files)
- Copy this file to your mods Assets folder and import it in code
AssetBundle ab = LoadAssets.LoadBundle(this,"something.unity3d");
GameObject go = ab.LoadAsset<GameObject>("test.prefab");
//REMEMBER to instantiate your object next.
ab.Unload(false); //unload when you take all items you need.
