博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
unity中加载新关卡函数简单用法
阅读量:4688 次
发布时间:2019-06-09

本文共 1804 字,大约阅读时间需要 6 分钟。

.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 。

• 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. is 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。

 

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

 

转载于:https://www.cnblogs.com/Dearmyh/p/9340822.html

你可能感兴趣的文章
python 二维字典
查看>>
编译原理实验一
查看>>
Git for Android Studio 学习笔记
查看>>
pip 警告!The default format will switch to columns in the future
查看>>
Arrays类学习笔记
查看>>
实验吧之【天下武功唯快不破】
查看>>
2019-3-25多线程的同步与互斥(互斥锁、条件变量、读写锁、自旋锁、信号量)...
查看>>
win7-64 mysql的安装
查看>>
dcm4chee 修改默认(0002,0013) ImplementationVersionName
查看>>
maven3在eclipse3.4.2中创建java web项目
查看>>
发布时间 sql语句
查看>>
黑马程序员 ExecuteReader执行查询
查看>>
记一些从数学和程序设计中体会到的思想
查看>>
题目1462:两船载物问题
查看>>
POJ 2378 Tree Cutting(树形DP,水)
查看>>
第二冲刺阶段个人博客5
查看>>
UVA 116 Unidirectional TSP (白书dp)
查看>>
第三方测速工具
查看>>
MySQL 网络访问连接
查看>>
在aws ec2上使用root用户登录
查看>>