超级简单的场景跳转
代码如下:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Onguijump : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{
if (GUI.Button(new Rect(1240, 0, 100, 50), "返回"))
{
Debug.Log("第一个Button被点击了!");
SceneManager.LoadScene("StartGame");
}
}
}
以左上角为原点 依次为 x y z
将其挂在Camera上,就可以实现场景跳转。
完事,干干干!