您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
41 行
997 B
41 行
997 B
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace UnityEngine.XR.ARFoundation.Samples
|
|
{
|
|
public class BackButton : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
GameObject m_BackButton;
|
|
public GameObject backButton
|
|
{
|
|
get => m_BackButton;
|
|
set => m_BackButton = value;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
if (Application.CanStreamedLevelBeLoaded("Menu"))
|
|
{
|
|
m_BackButton.SetActive(true);
|
|
}
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Escape))
|
|
{
|
|
BackButtonPressed();
|
|
}
|
|
}
|
|
|
|
public void BackButtonPressed()
|
|
{
|
|
if (Application.CanStreamedLevelBeLoaded("Menu"))
|
|
{
|
|
SceneManager.LoadScene("Menu", LoadSceneMode.Single);
|
|
LoaderUtility.Deinitialize();
|
|
}
|
|
}
|
|
}
|
|
}
|