我是Unity新手,想将场景拖放到类似于下一个场景选择中 公共游戏对象xxx;
因为我要处理多个场景,所以为新场景创建新脚本效率不高。预先感谢。
using UnityEngine;
using UnityEngine.SceneManagement;
using Vuforia;
public class Vb_changescene : MonoBehaviour, IVirtualButtonEventHandler {
public GameObject VirtualButton;
public GameObject Scenename;
// Use this for initialization
void Start()
{
VirtualButton = GameObject.Find("Next");
VirtualButton.GetComponent<VirtualButtonBehaviour>()
.RegisterEventHandler(this);
}
public void OnButtonPressed(VirtualButtonBehaviour vb)
{
Debug.Log("Btn Pressed");
SceneManager.LoadScene(Scenename);
}
public void OnButtonReleased(VirtualButtonBehaviour vb)
{
Debug.Log("Btn Released");
}
}