LoginSignup
1
1

More than 5 years have passed since last update.

How to make AssetBundle

Last updated at Posted at 2015-08-31

Article of Japanese

  1. Choose prefab
  2. See bottom of inspector
  3. Set AssetBundle name
  4. Create Assets/Editor/ExportAssetBundles.cs
  5. Choose menu -> Assets -> Unity 5.x Build AssetBundle
  6. Generate file into StreamingAssets folder
ExportAssetBundles.cs
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;

public class ExportAssetBundles : MonoBehaviour
{
    [MenuItem("Assets/Unity 5.x Build AssetBundle")]
    static void ExportResource_Unity5()
    {
        Debug.Log("Target=" + EditorUserBuildSettings.activeBuildTarget.ToString());

        // Folder name is PlatForm name
        string OutPutPath = Application.streamingAssetsPath + "/" + EditorUserBuildSettings.activeBuildTarget.ToString();

        if (Directory.Exists(OutPutPath) == false )
        {
            Directory.CreateDirectory(OutPutPath);
        }

        // Build AssetBundle at platform manifest.
        BuildPipeline.BuildAssetBundles(OutPutPath, 0, EditorUserBuildSettings.activeBuildTarget);
        Debug.Log("ComPress End");
    }
}
1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1