Application.LoadLevel 加载关卡

static function LoadLevel (index : int) : void

Description描述

Loads the level.

加载关卡,也就是加载一个新的场景。

This function loads level by its index. You can see the indices of all levels using the File->Build Settings... menu in Unity. Before you can load a level you have to add it to the list of levels used in the game. Use File->Build Settings... in Unity and add the levels you need to the level list there.

这个函数按照索引加载关卡。在Unity中使用File->Build Settings.....菜单可以看到所有 关卡的索引列表。在你能过加载关卡之前你必须将它添加到游戏使用关卡列表中。在 Unity中使用File->Build Settings.....并添加你需要的关卡到关卡列表中。

// Loads the level with index 0

//加载索引为 0 的关卡

Application.LoadLevel (0);

When loading a new level all game objects that have been loaded before are destroyed. If you want to let an object survive when loading a new level, use Object.DontDestroyOnLoad.

当加载新的关卡时,所有已经加载的游戏物体都将被销毁。 如果你想让物体在被加 载新关卡时不被销毁,使用Object.DontDestroyOnLoad 。

• static function LoadLevel (name : string) : void

Description描述

Loads the level by its name.

通过名称加载关卡,也就是说按照名字加载新的场景。

Before you can load a level you have to add it to the list of levels used in the game. Use File->Build Settings... in Unity and add the levels you need to the level list there. MonoBehaviour.OnLevelWasLoadedis called on all active game object's after the level has been loaded.

在你能够加载关卡之前你必须将它添加到游戏使用的关卡列表中。在Unity中使用File->Build Settings..... 并添加你需要的关卡到关卡列表中。关卡被加载所有激活物体上 的MonoBehaviour . OnLevelWasLoaded都被调用。

// Load the level named "HighScore".

// 加载名为"HighScore"的关卡。

Application.LoadLevel ("HighScore");

When loading a new level all game objects that have been loaded before are destroyed. If you want to let an object survive when loading a new level, use Object.DontDestroyOnLoad.

当加载新的关卡时,所有已经加载的游戏物体都将被销毁。 如果你想让物体在加载新关卡时不被销毁,使用Object. DontDestroyOnLoad。

void OnLevelWasLoaded(int sceneLevel)在加载新场景时被调用 ,sceneLevel指的是场景索引

unity 加载关卡_unity中加载新关卡函数简单用法相关推荐

  1. python count函数代码_python中count函数简单用法

    python中count函数简单用法 python中count函数的用法 Python count()方法 描述 Python count() 方法用于统计字符串里某个字符出现的次数.可选参数为在字符 ...

  2. JavaScript中常见的字符串操作函数及用法汇总

    转载地址:http://www.jb51.net/article/65358.htm 这篇文章主要介绍了JavaScript中常见的字符串操作函数及用法,实例汇总了javascript常见的字符串转换 ...

  3. java中instr函数_Oracle的substr和instr函数简单用法

    Oracle的substr函数简单用法 substr(字符串,截取开始位置,截取长度) //返回截取的字 substr('Hello World',0,1) //返回结果为 'H'  *从字符串第一个 ...

  4. Matlab中print, fprint, fscanf, disp函数的用法

    最近一直在用python,导致学习的一些函数就有点混淆,趁着这会儿看代码,就再回顾下Matlab中print, fprint, fscanf, disp函数的用法 一.print() 函数可以把函数图 ...

  5. unity头顶状态制作_Unity中结合IK实现Lookat

    前言 之前只是花个周末复读了一篇育碧的演讲,讲到一些周边系统,程序化镜头,口型匹配,角色补光,景深,Lookat,我都玩过一点,很多在2U引擎里都算是标配;本以为投靠Unreal可以缓解大部分周边系统 ...

  6. 打包到指定目录_linux中打包文件tar命令的简单用法

    tar 是tape archive的缩写,原理就是把多个文件前后连在一起,形成一个大的文件,tar命令并不对文件进行压缩. tar打包文件起码要跟上2个选项:-cf,-c选项是创建打包文件,-f选项是 ...

  7. 转载://C++中getline()、gets()等函数的用法

    在学习C++的过程中,经常会遇到输入输出的问题,以下总结一下下面几个函数的用法: 1).cin 2).cin.get() 3).cin.getline() 4).getline() 5).gets() ...

  8. C++中getline()、gets()等函数的用法

    在学习C++的过程中,经常会遇到输入输出的问题,以下总结一下下面几个函数的用法: 1).cin 2).cin.get() 3).cin.getline() 4).getline() 5).gets() ...

  9. fopen函数的用法示例_在C和C ++中使用fopen()函数的用法以及示例

    fopen函数的用法示例 In C and C++ programming languages fopen() function is used to open files and make oper ...

最新文章

  1. Openstack_通用技术_RPC 远程异步调用
  2. python怎么随机生成数据_Python-随机生成数据
  3. ClickHouse之集群搭建以及数据复制
  4. 计算机一般的应用课题方向,计算机类哪个方向的课题好立项
  5. 流利的接口不利于维护
  6. 文件逆顺输出到新文件(三种方案)
  7. Positional Encodings in ViTs 近期各视觉Transformer中的位置编码方法总结及代码解析 1
  8. 信息学奥赛一本通(1088:分离整数的各个数)
  9. 服务器无法拖动文件复制文件,​IT服务器运维:艾锑人为您整理Win10系统下移动、复制、删除文件需要管理员权限的解决方法...
  10. 随机漫步(random walk)
  11. 数据链路层解决的三个问题
  12. 认认真真推荐几个ATM大神的公众号
  13. 如何查看Python源代码
  14. 了解BigBoss之如何添加BigBoss的Cydia源地址
  15. 边境的悍匪—机器学习实战:第十一章 训练深度神经网络
  16. 微信突破版本限制永久设置透明/半透明头像
  17. python中ipaddress库用法详解
  18. Unity3D安装:从命令行安装 Unity
  19. ftp主动模式和被动模式的区别
  20. 四大研究领域揭示自然语言技术的奥秘

热门文章

  1. linux下卸载httpd,Linux卸载系统自带的httpd的方法
  2. Unity优化篇 - 音频优化
  3. EOJ 2849 成绩排序 C++
  4. HTML实现3D相册
  5. 100G光模块之后,200G,400G谁将成为市场宠儿
  6. 在酒店共享上网的设置
  7. 练习:控制台获取字符串,我喜欢你Java ,Java你喜欢我吗? 让其变成:我喜欢你 ,你喜欢我吗?,并查看java出现的次数
  8. 直播开篇——电商直播系统源码直播场景和技术分析
  9. 好玩的html程序,好玩的Html跑马灯
  10. 做一个微信语音点播系统