Tips:
字体一定要大,90左右。
太小了看不见文本框。
双击左侧文本对象,以找到文本框。
把GameManager.cs绑定到各个场景的主摄像头,即可实现多场景切换。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyUp(KeyCode.Alpha1))
{
SceneManager.LoadScene(1);
}
if (Input.GetKeyUp(KeyCode.Alpha2))
{
SceneManager.LoadScene(2);
}
if (Input.GetKeyUp(KeyCode.Alpha3))
{
SceneManager.LoadScene(3);
}
if (Input.GetKeyUp(KeyCode.M))
{
SceneManager.LoadScene(0);
}
if (Input.GetKeyUp(KeyCode.Escape))
{
Application.Quit();
Debug.Log("游戏退出");
}
}
}