找回密码
 立即注册
查看: 3256|回复: 47

[简易教程] unity创建场景并跳转

[复制链接]
发表于 2017-12-18 20:00 | 显示全部楼层 |阅读模式
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;//注意这个不能少  
  5. using UnityEditor.SceneManagement;

  6. public class MainScene : MonoBehaviour {

  7.     // Use this for initialization
  8.     void Start () {
  9.         GameObject btnObj = GameObject.Find ("Button");
  10.         Button btn = btnObj.GetComponent<Button> ();
  11.         btn.onClick.AddListener (delegate(){
  12.             this.runGotoOtherScene(btnObj);
  13.         });
  14.     }
  15.     public void runGotoOtherScene(GameObject btnObj){
  16.         EditorSceneManager.LoadScene ("GameScene1");
  17.         Debug.Log ("click this btn!");
  18.     }
  19.     // Update is called once per frame
  20.     void Update () {
  21.         
  22.     }
  23. }
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
发表于 2017-12-26 16:56 | 显示全部楼层
楼主是超人
发表于 2017-12-26 16:25 | 显示全部楼层
真心顶
发表于 2017-12-26 17:02 | 显示全部楼层
难得一见的好帖
发表于 2017-12-26 17:23 | 显示全部楼层
说的非常好
发表于 2017-12-26 17:08 | 显示全部楼层
不错不错
发表于 2017-12-29 07:54 | 显示全部楼层
好帖就是要顶
发表于 2017-12-29 07:07 | 显示全部楼层
顶顶多好
发表于 2017-12-29 07:05 | 显示全部楼层
难得一见的好帖
发表于 2017-12-29 07:00 | 显示全部楼层
说的非常好
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-5-9 21:23 , Processed in 0.102772 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表