关于安全:Unity3d场景切换

1次阅读

共计 400 个字符,预计需要花费 1 分钟才能阅读完成。

startGame.cs

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class startGame : MonoBehaviour {

// Use this for initialization
void Start () {

    Button btn = transform.GetComponent<Button>();// 获取场景中的按钮
    btn.onClick.AddListener(eventListener);// 点击事件触发(回调)

}

// Update is called once per frame
void Update () {

}

void eventListener()
{createNewScene.create.loadScene("createMan");//“createMan”是新场景名称
}

}

// 运行第一个场景,点击按钮,场景产生切换

正文完
 0