Selected Game Object#
Input / Selected Game Object
Can Read
Cannot Write
Description#
The user interface Game Object that is currently selected
Code#
using System;
using UnityEngine;
using UnityEngine.EventSystems;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Selected Game Object")]
[Category("Input/Selected Game Object")]
[Description("The user interface Game Object that is currently selected")]
[Image(typeof(IconSelectable), ColorTheme.Type.TextLight)]
[Keywords("UI", "Canvas", "Focus", "Highlight", "Navigation", "Button")]
[Serializable]
public class TypeGameObjectInputSelectedUI : TypeGameObject
{
public override GameObject Get(Args args)
{
EventSystem eventSystem = EventSystem.current;
return eventSystem != null ? eventSystem.currentSelectedGameObject : null;
}
public override string ToString()
{
return "Selected Game Object";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}