Version: Unity 6.1 Alpha (6000.1)
LanguageEnglish
  • C#

Clickable.clicked

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Callback triggered when the target element is clicked.

The clicked and clickedWithEventInfo events are invoked when any of the following conditions occur:

If the delay and interval optional constructor parameters are used, then the clicked event is considered repeatable and is instead invoked when any of the following conditions occur:

If the clicked event is repeatable, then the first repeated click occurs after an amount of time corresponding to the delay parameter, and subsequent clicks occur after amounts of time corresponding to the interval parameter.

The callback methods registered to this event should have no parameters and return no value.

This manipulator makes use of pointer capture.

Additional resources: Clickable.clickedWithEventInfo, NavigationSubmitEvent, PointerDownEvent, PointerCaptureEvent

 public VisualElement CreateButton()
 {
     var button = new Button { text = "Press Me" };
     button.clicked += () =>
     {
         Debug.Log("Button was pressed!");
     };
     return button;
 }