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");
Page last updated: 2010-12-15