How to load a scene from disk in Standalone player

Hello all,

i’m trying since this morning to dynamically load a scene from a pc standalone player without any result, i have an error that says that le scene wasn’t defined in build settings (which is what i want to be able to add new to my game without building a new player).

I’m doing the following :

First generate the asset bundle for the level.

string[] level = new string[1];
level[0] = "Assets/workLevel.unity";
BuildPipeline.BuildStreamedSceneAssetBundle( level, "test", BuildTarget.StandaloneWindows) );

Also tried to build the bundle with buildplayer

BuildOptions options = BuildOptions.BuildAdditionalStreamedScenes;
BuildPipeline.BuildPlayer(new string[1]{"Assets/workLevel.unity"}, "test", BuildTarget.StandaloneWindows, options);	

Both of these methods leads to the same result…

When want to load my level i’m doing the following :

string path = "file://" + Application.dataPath + "/../test.unity3d";
WWW www = WWW.LoadFromCacheOrDownload(path,1);
yield return www;
Debug.Log (www.error); // gives no error
AssetBundle ab = www.assetBundle;
Application.LoadLevel("testserver");

The result is that no level is loaded and that an error message "Level test (-1) could’nt be loaded because it has not been added to the buildsetting… etc…

Can someone help me ? It should be possible…

Thanks by advance

Stéphane

Every scene, which should be in build has to be added in buildsettings. You have to add first scene using Add Current button, others just add automatically.