---
tags:
    - "UI"
    - "Canvas"
    - "Focus"
    - "Highlight"
    - "Navigation"
    - "Button"
---

# Selected Game Object

[Input](index.md) / **Selected Game Object**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

The user interface Game Object that is currently selected

## Code

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

