言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Application.LoadLevel

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function LoadLevel(name: string): void;
public static void LoadLevel(string name);
public static def LoadLevel(name as string) as void

Parameters

index ロードするレベルのインデックス
name ロードするレベルの名前

Description

その名前またはインデックスによってレベルをロードします。

レベルをロードする前にゲームで使用するレベルのリストにロードするレベルを追加しておかなくてはいけません。 Unityの File->Build Settings... を選択し、レベルのリストに必要なレベルを追加します。 MonoBehaviour.OnLevelWasLoadedはレベルがロードされた直後に全てのアクティブなゲームオブジェクトで呼び出されます。

	// Load the level named "HighScore".

	Application.LoadLevel ("HighScore");
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        Application.LoadLevel("HighScore");
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		Application.LoadLevel('HighScore')

新しいレベルをロードしている時に全てのゲームオブジェクトはロードが完了するまでに破棄されます。 新しいレベルをロードする時にオブジェクトを破棄させないようにするには、DontDestroyOnLoad関数を使用します。 LoadLevelを呼び出すと Application.loadedLevelApplication.loadedLevelName が更新されます。 See Also: Application.LoadLevelAsync, Application.LoadLevelAdditive, Application.LoadLevelAdditiveAsync.