02 June, 2022

Create Asset bundle in Unity3d

 Original Source: http://gyanendushekhar.com/2016/06/16/create-asset-bundle-unity3d/


Create Asset Bundle in unity3d – step by step guide

Step 1

Select the asset that you want to add in asset bundle. In the bottom of Inspector pane, click on asset bundle field.



Step 2

Click on the new if you want to add your asset in new asset bundle or select the already named asset bundle. You will get the entire named asset bundle over here.

You can add multiple assets to a single asset bundle name.

Create Asset bundle in unity3d -2

Step 3

Write the name of the asset bundle and hit ENTER key. Then you will see name of your asset bundle in the AssetBundle field.

Create Asset bundle in unity3d-3

Step 4

Add Editor Folder in Assets folder and add below script in this folder.  Asset bundles are platform (android, iOS etc) dependent; so generate asset bundle accordingly. You can select platform by setting BuildTarget argument.  For below code, assets bundles will be generated in “Assets/AssetBundles” folder.

Step 5

Click on BuildAssetBundles (Assets -> BuildAssetBundles) to generate asset bundles.



Once you will click on BuildAssetBundle as shown in above image, asset bundles will be generated in AssetBundles directory. Make sure that you have created AssetBundles directory in Assets folder, before generating asset bundles.

No comments:

Post a Comment