Version: 2022.1
LanguageEnglish
  • C#

LoadSceneMode

enumeration

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

Submission failed

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

Close

Cancel

Description

Used when loading a Scene in a player.

Use LoadSceneMode to choose what type of Scene loads when using SceneManager.LoadScene. The available modes are Single and Additive.

Single mode loads a standard Unity Scene which then appears on its own in the Hierarchy window. Additive loads a Scene which appears in the Hierarchy window while another is active.

using UnityEngine;
using UnityEngine.SceneManagement;

public class Example : MonoBehaviour { void OnGUI() { //This displays a Button on the screen at position (20,30), width 150 and height 50. The button’s text reads the last parameter. Press this for the SceneManager to load the Scene. if (GUI.Button(new Rect(20, 30, 150, 30), "Other Scene Single")) { //The SceneManager loads your new Scene as a single Scene (not overlapping). This is Single mode. SceneManager.LoadScene("YourScene", LoadSceneMode.Single); }

//Whereas pressing this Button loads the Additive Scene. if (GUI.Button(new Rect(20, 60, 150, 30), "Other Scene Additive")) { //SceneManager loads your new Scene as an extra Scene (overlapping the other). This is Additive mode. SceneManager.LoadScene("YourScene", LoadSceneMode.Additive); } } }

Properties

SingleCloses all current loaded Scenes and loads a Scene.
AdditiveAdds the Scene to the current loaded Scenes.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961