# GetAllScenes()

> Returns an array of all the Scenes currently open in the hierarchy.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.SceneManagement](/engine/6000.7/script-reference/unityengine/scenemanagement.md)
* **Assembly:** UnityEngine.CoreModule

> **Warning:**
>
> **Deprecated.** Use SceneManager.sceneCount and SceneManager.GetSceneAt(int index) to loop the all scenes instead.

```csharp
public static Scene[] GetAllScenes()
```

### Returns

| Type                                                                              | Description                       |
| --------------------------------------------------------------------------------- | --------------------------------- |
| [Scene\[\]](/engine/6000.7/script-reference/unityengine/scenemanagement/scene.md) | 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](/engine/6000.7/manual/building-and-publishing/build-settings.md).

```csharp
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](/engine/6000.7/script-reference/unityengine/scenemanagement/scenemanager/scenecount.md) and [SceneManager.GetSceneAt()](/engine/6000.7/script-reference/unityengine/scenemanagement/scenemanager/getsceneat.md) instead.
