- Home /
[C#] Is it possible to instantiate a scene?
More accurately can I instantiate a scene; make a copy and call it through script for it to load. I would like to make it a default scene, with the basics (Skybox and some GUI). But I would like copies of this same scene to be loaded for a multiplayer purpose game.
Answer by Kiwasi · Oct 22, 2014 at 09:23 PM
For editor applications you can use this NewScene.
For runtime applications you can simply load a blank scene and build the entire scene via code. Another option to explore is pseudo scenes. Make multiple areas within the same scene and move the camera about as needed.
Instantiating a scene really doesn't make sense, as your game can only be in one scene at a time.
Yeah I suppose you're right. I was thinking after clicking the [Start] button, then it would create an existing scene (basically like the prefab, and how you instantiate that). And by create I meant instantiate. But thanks for the help! This makes sense to me.
Answer by thef1chesser · Oct 22, 2014 at 07:07 PM
You can create a new scene with those things in it, add it to build settings and then call it by Application.LoadLevel("name");
But I don't think it's possible to create an empty scene by code.
Hmm, basically I want to create a table with four people (Card Game), But when I have people load into that scene itself, ins$$anonymous$$d of creating a bunch of tables (scene rooms we'll call it) I don't want them to join the same scene with the same table and cards dealt. If they are trying to create a different table. I am sure I can implement these many scenes just by copying and pasting them; I was just curious if there was an easier way?
Do you mean like online connection and that the people joining basically have their own scene to play in?
Yah, exactly like that mann. I mean, I guess I don't know how multiplayer works, but how would I do this?
well... Try looking at the Unity network options. Searching for info about it gives me tutorials from several game studios. I'm pretty new to that stuff as well and still figuring that out.
Answer by bubzy · Oct 22, 2014 at 09:17 PM
you need networking for this to happen, check out Photon
http://u3d.as/content/exit-games/photon-unity-networking-free/2ey
https://www.youtube.com/watch?v=AIgwZK151-A∈dex=1&list=PLbghT7MmckI7BDIGqNl_TgizCpJiXy0n9
this uy made some nice tutorials for using photon, while it doesn't really fit a card game, the principles are exactly the same. if you made a scene that instantiated a copy of itself, it would have that code in it, to instantiate another, and another, and another, finally your program would become sentient and start plotting its way into the internet to take over the world and destroy humanity, do the world a favour and look up the networking!
Your answer
Follow this Question
Related Questions
Potential 4.3.1f1 bug Instantiate c# 2 Answers
How to load a scene level randomly without repeating 2 Answers
Distribute terrain in zones 3 Answers
Intantiate problems 1 Answer
Multiple Cars not working 1 Answer