ドキュメント

Unity Engine

Unity Engine

GetAllScenes()

Returns an array of all the Scenes currently open in the hierarchy.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

注意
Deprecated. Use SceneManager.sceneCount and SceneManager.GetSceneAt(int index) to loop the all scenes instead.
public static Scene[] GetAllScenes()

Returns

Type

Description

Scene[]Array of Scenes in the Hierarchy.

Remarks

This list will contain all the Scenes currently open in the hierarchy. This is not necessarily the same as all the Scenes that exist in your project, or that are listed in the Build Settings.
using UnityEngine;using UnityEngine.SceneManagement;public class ExampleScript : MonoBehaviour{ void Start() { Scene[] scenes = SceneManager.GetAllScenes(); foreach (Scene sc in scenes) Debug.Log("'" + sc.name + "'"); }}
This API is obsolete. Please use SceneManager.sceneCount and SceneManager.GetSceneAt() instead.