Application.levelCount 关卡数

static var levelCount : int

Description描述

The total number of levels available (Read Only).

可用的关卡总数。(只读)

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		Application.LoadLevel(Random.Range(0, Application.levelCount - 1));
	}
}
// Loads a random level
//随机加载一个关卡
Application.LoadLevel (Random.Range(0, Application.levelCount-1));
Page last updated: 2010-12-14