- Home /
Create and Name a new scene through the script.
Hi, I've been working on my project for a few weeks now and starting to get to some meatier items.
I have a solarsystemgen script. It generates a star, planets and gives them rotations and orbits. I need to reuse this script to make more solarsystems in case the player travels out from the starting solarsystem. I need to make two scenes per planet generated. Since there is a random chance of spawning a planet (thats how ive setup the code) it is important that the script checks to see if a planet was made and if so then make a newscene, name it, apply it to the Build Settings --> Scenes in Build, and then make it run its own stuff.
Im not familiar with the static void NewScene(); it needs a return type which I cant find what it is. It says game object but when I try variations of gameObject it still gives an error.
Any suggestions?
Thank You
Answer by HappyMoo · Jan 03, 2014 at 10:59 PM
You can't make new Scenes at game runtime. If you need to create other planets, you need to create them in the same scene and then move the player to the new location and then delete the old planets if you don't need them anymore
so what is the purpose of this?
http://docs.unity3d.com/Documentation/ScriptReference/EditorApplication.NewScene.html
It allows you to create scenes in the editor, but not in play mode or on a deployed build (hence why it is in the UnityEditor namespace).
Your answer
Follow this Question
Related Questions
change to glow texture on mouse click 0 Answers
A node in a childnode? 1 Answer
Scene saving 3 Answers
How to create a complicated game over scenario ? HELP 0 Answers
Scene Audio Script Error 2 Answers