高防服务器

Unity3d场景切换

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”是新场景名称 }

}

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

[温馨提示:高防服务器能助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。]

[图文来源于网络,不代表本站立场,如有侵权,请联系高防服务器网删除]