Application.LoadLevelAdditive 累加关卡

static function LoadLevelAdditive (index : int) : void
static function LoadLevelAdditive (name : string) : void

Description描述

Loads a level additively.

累加一个关卡,也就是说,加载一个新的场景,当前场景不会被销毁。

Unlike LoadLevel, LoadLevelAdditive does not destroy objects in the current level. Objects from the new level are added to the current scene. This is useful for creating continuous virtual worlds, where more content is loaded in as you walk through the environment.

不像LoadLevel,LoadLevelAdditive不销毁当前关卡的物体。物体从新的关卡添加到当前的场景。这对创建连续的虚拟世界很有用,在你漫步环境,更多的内容被加载进来。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		Application.LoadLevelAdditive(1);
		Application.LoadLevel("MoreStuff");
	}
}
// Loads the level with index 1
//加载关卡索引为1的关卡
Application.LoadLevelAdditive (1);

// Load the level named "MoreStuff".
//加载名为MoreStuff的关卡
Application.LoadLevel ("MoreStuff");
最后修改:2010年12月15日 Wednesday 20:25

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。