Home > other >  Unity to return
Unity to return

Time:09-30

How do the Unity to make back button

CodePudding user response:

Do you want to return to the last scene, or return to which step?

CodePudding user response:

Return on a scene,,,,,,,

CodePudding user response:

Return on a scene or jump scene, actually scenemanager. Load the API

CodePudding user response:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Using UnityEngine. SceneManagement;


Public class TouchType: MonoBehaviour
{


//Use this for initialization
Void the Start ()
{

}

//Update is called once per frame
Void the Update ()
{
If (Input. GetMouseButtonDown (0))
{//judge whether the click event
Ray Ray=Camera. Main. ScreenPointToRay (Input. MousePosition);
RaycastHit hitInfo;
If (Physics. Raycast (ray, out hitInfo))
{
//if it is a finger touching the screen and is the first touch screen
If (Input. TouchCount==1 & amp; & Input. GetTouch (0). The phase==TouchPhase. Began)
{
If (Input. GetTouch (0). TapCount==2 & amp; & HitInfo. Starts. GameObject. Name=="wolun")
//the number of judgment, click
{//in this add to trigger events
V5 SceneManager. LoadScene (" ");
}

}
}
}
}

}

CodePudding user response:

Every time save the scenario name change scene, take back,

CodePudding user response:

Can do an enumeration, do a state manager so that you can do return to a state (scenario)
  • Related