Create a new 3 scene, create a new GUI Text, set different values to differentiate
File->build settings, drag three scenes (scenes in build) to see the scene name and scene index.
As long as the tick is selected, these scenes will appear when released into the finished product.
Then write the script to switch
Using unityengine;using System.collections;public class newbehaviourscript:monobehaviour{//Use this for Initializat ion void Start () {}//Update is called once per frame void Update () {if (Input.getkeydown (KEYC Ode. A) {//load scene, can use scene name or scene index Application.loadlevel (0); } if (Input.getkeydown (keycode.b)) {application.loadlevel (1); } if (Input.getkeydown (keycode.c)) {application.loadlevel (2); } if (Input.getkeydown (keycode.space)) {//press SPACEBAR to truncate the current scene into a 1.png picture APPLICATION.CAPTURESCR Eenshot (@ "C:\Users\Administrator\Desktop\1.png"); } if (Input.getkeydown (KEYCODE.D)) {//Opens a URL with the default browser Application.openurl ("http://www.ba Idu.com "); } if (Input.getkeydown (Keycode.escape)) {//Exit program Application.Quit (); } }}
Drag the script to each scene, because each scene executes the script: double-click Scene > Camera---give the script to the camera
If you want to see Quit (), the effect will be more obvious if you publish it as a finished product.
File->build Settings->build and run
Using application to realize the switching of scenes