How to download and load a scene during runtime?


The title already explains the question. I want to download a scene from a server and then load it while the game is playing. Do I just store a .scene file on the server and download it? Aren’t there any other required files that also need to be downloaded? I can’t use assetbundles because I don’t have Unity pro.

Thanks in advance

this is not so evident
You have to negociate with assetbundles (cf unity script reference)

You have 2 types of AssetBundles (one containing scenes, and the other containing any objects you want excluding scenes).

The first one can contain a complete scene (and so configurations) and keep reference on script attached to gameobject and its public values but will be missing after loading, because streamed scene doesn’t include script, only reference and values. So the tips is to include the script in your main application and your streamed scene will recognize this script and script won’t be missing. (see about Angry Ants solution: mono runtime to precompiled script into dll and load it dynamically)

The last one, can just contain prefabs (script included) and assets which are not in a scene. But there is the same problem : script included in the bundle will be missing, but here you can get the name of missing scripts contrary to streamed scene in which you can’t see the contents before loading. Unfortunately your assets doesn’t have any space configuration as in a streamed scene.

Hope my informations are understandable

The problem i found

Against duplicated loaded assets

Read these docs:

AssetBundles are the preferred method. For $1500USD you’ll save yourself the trouble of the alternative: find/write a scene importer. I would recommend X3D as it includes all aspects of a scene (not just geometry and textures like Collada or worse, OBJ). Strike that. I would recommend saving up to get Pro as scene import is hard. That is, until I release my X3D importer!

My thought. create scene with basic information and objects need for each level. Then create the level under an empty game object at 0,0,0. Save game object as prefab.

When you start a new level load empty scene and then instantiate empty game object prefab from asset folder at location 0,0,0, done, level loaded. All levels saved as prefabs.

Anyone think this will work? or is a good idea?

Hate not being able to load from file!!! i want level structure like \asset\1\1\scene for world 1 level 1. and then you can have icons in the same folder for overlays etc. and maybe music.mp3 files to load for each level. or anything you want for each level. would make it easy to modify the game layout. like remove level 4 or move 4 to 6 and 6 to 4 etc… in case 6 is easier then 4.

Guess ill do the same but load each scene into build settings in the correct order.