12345678910111213141516171819202122232425262728293031323334353637383940 |
- using UnityEngine;
- using UnityEngine.SceneManagement;
- namespace Unity.WebRTC.Samples
- {
- internal 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);
- }
- }
- }
- }
|