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;
}
}