---
tags:
    - "UI"
    - "Canvas"
    - "Button"
    - "Click"
    - "Press"
    - "Push"
    - "Submit"
---

# On Button Click

[UI](index.md) / **On Button Click**

## Description

Executed when the Button on the target game object is clicked

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime.UI
{
    [Title("On Button Click")]
    [Image(typeof(IconUIButton), ColorTheme.Type.TextLight)]

    [Description("Executed when the Button on the target game object is clicked")]
    [Category("UI/On Button Click")]

    [Keywords("UI", "Canvas", "Button", "Click", "Press", "Push", "Submit")]

    [Serializable]
    public class TriggerCoreUIButton : TriggerHandleSourceBase<HandleOnUIButton>
    {
        // PROPERTIES: ----------------------------------------------------------------------------

        protected override string GetTitle(GameObject source) => $"{this.SourceName} Button Click";

        // OVERRIDE METHODS: ----------------------------------------------------------------------

        protected override void OnTrigger(GameObject target)
        {
            using Args args = Args.Get(this.Component, target);
            this.Run(args);
        }
    }
}
```

