- Home /
How to get the names of scene in AssetBundle?
I'm creating an asset bundle with one scene like this:
var ret = BuildPipeline.BuildPlayer('Assets/Houston', savePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.BuildAdditionalStreamedScenes);
Once I download the object with
var sceneWWW = WWW.LoadFromCacheOrDownload(sceneUrl, 0);
How can I get the name of the scene that is saved in the asset bundle from sceneWWW.assetBundle (ie. 'Houston' in this case)? assetBundle.mainAsset is null, and assetBundle.name is null.
Thanks!
Answer by drawcode · Aug 04, 2012 at 09:59 AM
Scenes can only be embedded with BuildStreamedSceneAssetBundle passing in the list of scenes in that bundle.
@MenuItem ("Build/BuildWebplayerStreamed")
static function MyBuild(){
var levels : String[] = ["Assets/Level1.unity"];
BuildPipeline.BuildStreamedSceneAssetBundle( levels, "Streamed-Level1.unity3d", BuildTarget.WebPlayer);
}
You can use assetBundle.Contains to check names before assetBundle.Load("nameoflevel"); or assetBundle.LoadAll(); to load the asset you need by scene name or asset name.
The way you save your scenes and build then with