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.