- Home /
Creating scene from code
Hi,
I'm making a coop space game. I wanted a big space world, and I was thinking of making each part of space (solar systems, planetary belts, ... or something, not yet sure of the size) it's own scene. So I'll have a bunch a scenes, each with a different place in space which you can jump towards. I might make some parts of space by hand, but others should be generated (at start probably all will be generated.)
So, I was thinking, making a scene structure, with each scene named like: "space-X-Y-Z" (with X, Y and Z being numbers.) Then you can jump towards any combination of x,y and z, it'll check if this already exists, and if not create a new scene with this name and generating content for it.
Now, I think my thinking is pretty solid, though I can't seem to find how I can create a new scene at runtime. Is this even possible?
Note: Would very much appreciate, if you give any coding samples, you do this in c#, since that's what I'm using.
Thanks!
-Pablo
Answer by ScroodgeM · Aug 06, 2012 at 08:50 PM
if your scene will generate on client side, you will not be able to save it to scene so that other players are also able to see the same scene.
i would do the simple thing: generate your scene basing on random seed, and seed calculate based on coordinates. so, 10 different players on loading scene in same coordinates will see the same scene.
you just should describe the algorithm once and forget about continuously increasing scene quantity and client's data size 8)
feedback here if this solution is not applicable
well I was just thinking, do the random stuff on one computer, and then just generate that same scene on all connected players as well (by sending object information to the other players.) Though there might be better ways (if you know any.) Though I was just wondering how to create a new scene (not bothering with the lan-coop stuff yet), once I can do that, I can start thinking about how to get that scene to the other players :P
Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220613075256im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Can a script be loaded to a next scene? 3 Answers
Help with loading a scene,Help changing scenes (C~ script) 1 Answer
2d Object floating in space HELP! 1 Answer