---
tags:
    - "Hierarchy"
    - "Top"
    - "Level"
    - "Loaded"
    - "Search"
    - "Find"
---

# Root Objects

[Scene](index.md) / **Root Objects**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

The collection of Game Objects placed at the root of a loaded scene

## Parameters

| Name | Description |
| :--- | :---------- |
| Scene | The scene whose root Game Objects are collected |

## Code

```cs
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Root Objects")]
    [Category("Scene/Root Objects")]

    [Description("The collection of Game Objects placed at the root of a loaded scene")]
    [Image(typeof(IconUnity), ColorTheme.Type.Blue, typeof(BadgeList))]

    [Parameter("Scene", "The scene whose root Game Objects are collected")]

    [Keywords("Hierarchy", "Top", "Level", "Loaded", "Search", "Find")]

    [Serializable]
    public class TypeCollectionGameObjectsSceneRoot : TypeCollectionGameObjects
    {
        // EXPOSED MEMBERS: -----------------------------------------------------------------------

        [SerializeField] private GetScene m_Scene = new GetScene();

        // PUBLIC METHODS: ------------------------------------------------------------------------

        public override void Get(Args args, List<GameObject> values)
        {
            values.Clear();

            Scene scene = SceneManager.GetSceneByBuildIndex(this.m_Scene.Get(args));
            if (!scene.IsValid() || !scene.isLoaded) return;

            scene.GetRootGameObjects(values);
        }

        public override string ToString()
        {
            return $"{this.m_Scene} Root Objects";
        }

        // PROTECTED METHODS: ---------------------------------------------------------------------

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

```

