- Home /
How to download and load a scene during runtime?
Hi,
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
I would like to know this too, and I am using Unity Free too :D
Answer by PommPoirAbricot · Jun 06, 2013 at 04:26 PM
Hi 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
http://docs.unity3d.com/Documentation/Manual/scriptsinassetbundles.html
http://answers.unity3d.com/questions/9688/dynamically-loading-scripts.html
http://docs.unity3d.com/Documentation/ScriptReference/BuildPipeline.html
The problem i found
http://answers.unity3d.com/questions/468762/need-to-get-the-name-of-missing-scripts-via-warnin.html
Against duplicated loaded assets
http://answers.unity3d.com/questions/241158/problem-with-loadall-it-duplicate-the-objects.html
http://answers.unity3d.com/questions/343578/get-variables-from-a-null-component.html
Answer by Graham-Dunnett · Jun 06, 2013 at 03:11 PM
I'm not developing a web player game. Sorry for not mentioning it,
Answer by DaveA · Jun 06, 2013 at 04:31 PM
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!
Great !! I didn't know that option ! Since 2009 ! So I will see that more in detail !
Can you export import at runtime scenes and when loading it keeping track of attached scripts ?
Or simply get name of missing script after or before loading ?
Can you use it on android and iOS ?
In what this differe from asset bundles ?
Answer by pRoFlT · Dec 29, 2015 at 07:38 AM
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613103639im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Not download/load from cache for second time 0 Answers
how can i load different videos using one scene 1 Answer
Cannot download obj file from server and save to Assets correctly (runtime) 0 Answers
Create new scene at runtime 1 Answer
Load data from file, if scene changed, fails to load location 0 Answers