startUI告一段落
This commit is contained in:
1 parent
f8154f92b3
commit
da28b62f7f
34 files changed
+17562
-8231
No files matched your search
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
// 按 Esc 回到 StartUI (目前給測試場景用,正式場景之後可能改成暫停選單)
|
||||
public class ReturnToStartUI : MonoBehaviour
|
||||
{
|
||||
[Header("場景")]
|
||||
[Tooltip("要回去的場景名稱 (需加入 Build Profiles 的場景清單)")]
|
||||
public string startSceneName = "StartUI";
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Keyboard.current != null && Keyboard.current.escapeKey.wasPressedThisFrame)
|
||||
{
|
||||
// 遊戲中滑鼠會被鎖住,回 UI 前先放開
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
|
||||
SceneManager.LoadScene(startSceneName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7476136b8e96ce244a2d91081104938c
|
||||
Reference in new issue
Block a user