Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Game Object Scene#

Game Object / Game Object Scene

  • Can Read

  • Cannot Write

Description#

The scene the specified Game Object belongs to

Parameters#

Name Description
Game Object The Game Object whose scene is returned

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Game Object Scene")]
    [Category("Game Object/Game Object Scene")]

    [Description("The scene the specified Game Object belongs to")]
    [Image(typeof(IconUnity), ColorTheme.Type.Blue, typeof(BadgeCubeOutline))]

    [Parameter("Game Object", "The Game Object whose scene is returned")]

    [Keywords("Loaded", "Belongs", "Owner", "Level", "Where")]

    [Serializable]
    public class TypeSceneGameObject : TypeScene
    {
        [SerializeField] private GetGameObject m_GameObject = new GetGameObject();

        public override int Get(Args args)
        {
            GameObject gameObject = this.m_GameObject.Get(args);
            return gameObject != null ? gameObject.scene.buildIndex : -1;
        }

        public override string ToString()
        {
            return $"{this.m_GameObject} Scene";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.