BuildPipeline.BuildPlayer - Download scenes without adding them to build menu

Hi,

I am building a game with 10 levels. I would like to include the first 2 in the downloaded app but the rest are downloaded as asset bundles.

However if I don’t include them in the build, I get this error:

“Level ‘MyLevel3’ (-1) couldn’t be loaded because it has not been added to the build settings.
To add a level to the build settings use the menu File->Build Settings…”

How can I do this please?
Thanks.

1 Answer

1

Look up BuildPipeline.BuildStreamedSceneAssetBundle and editor code. That example code if you put it in the Assets/Editor folder will add a menu item that will build scene asset bundles that aren’t in the main file. Note its build target is the web player, you’ll have to change that if yours is a downloaded app.