Version: 5.5 (switch to 5.6b)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Method group is Obsolete

Application.levelCount

Obsolete public static int levelCount;

Description

The total number of levels available (Read Only).

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { Application.LoadLevel(Random.Range(0, Application.levelCount - 1)); } }