Game Object#
Can Read
Cannot Write
Description#
A scene or prefab Game Object
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Inline(nameof(m_Value), typeof(GameObject), true)]
[Title("Game Object")]
[Category("Game Object")]
[Description("A scene or prefab Game Object")]
[Image(typeof(IconCubeOutline), ColorTheme.Type.TextLight)]
[Keywords("Value", "Reference", "Object", "Prefab", "Component")]
[Serializable]
public class TypeGameObjectInstance : TypeGameObject
{
[SerializeField] private GameObject m_Value;
public override GameObject GetPreview(GameObject source) => this.m_Value;
public TypeGameObjectInstance()
{
this.m_Value = null;
}
public TypeGameObjectInstance(GameObject gameObject)
{
this.m_Value = gameObject;
}
public TypeGameObjectInstance(Component component)
{
this.m_Value = component != null
? component.gameObject
: null;
}
public override GameObject Get(Args args)
{
return this.m_Value;
}
public override string ToString()
{
return TextUtils.Name(this.m_Value);
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnEditorChange;
}
}