Assigning Asset Bundle in Script
I'm trying to assign scenes to asset bundles in an editor script. I searched around online and saw that you can edit the asset bundle of an asset by using:
Scene scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive);
EditorSceneManager.SaveScene(scene, scenePath);
EditorSceneManager.CloseScene(scene, true);
EditorApplication.SaveAssets();
AssetImporter assetImporter = AssetImporter.GetAtPath(scenePath);
assetImporter.assetBundleName = chunkName;
assetImporter.SaveAndReimport();
Unforunately this doesn't appear to work for scenes (it did work for TerrainData), 'assetImporter' becomes null.
Answer by memetic-arts · Jan 12, 2016 at 06:32 AM
It does work for scenes. Read this, and download the sample project:
Also read this (maybe even before the tutorial):
http://forum.unity3d.com/threads/the-assetbundle-manager-tutorial-q-a.354400/
Good Luck!
Answer by DrakkenWulf · Feb 27, 2017 at 02:56 AM
The question was regarding how to assign the bundle IDs to scenes from a script. The tutorial does not mention how this is possible. This question is still open.
Your answer
Follow this Question
Related Questions
Asset Bundle Error in Unity3D 5.4.3 0 Answers
Unity Restart Scene Glitches Help 0 Answers
FormatException: Input string was not in the correct format 0 Answers
how can i control scale speed ? 1 Answer
Start and use Timer outside Update 0 Answers