【m】插件上传
This commit is contained in:
41
Packages/com.unity.renderstreaming@3.1.0-exp.9/Samples~/Example/Scripts/BackButton.cs
vendored
Normal file
41
Packages/com.unity.renderstreaming@3.1.0-exp.9/Samples~/Example/Scripts/BackButton.cs
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Unity.RenderStreaming.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 (Keyboard.current != null && Keyboard.current[Key.Escape].wasPressedThisFrame)
|
||||
{
|
||||
BackButtonPressed();
|
||||
}
|
||||
}
|
||||
|
||||
public void BackButtonPressed()
|
||||
{
|
||||
if (Application.CanStreamedLevelBeLoaded("Menu"))
|
||||
{
|
||||
SceneManager.LoadScene("Menu", LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user