Clickable.clickedWithEventInfo

Description

Callback triggered when the target element is clicked, including event data.

See Clickable.clicked for more information on when the clicked and clickedWithEventInfo events are invoked. The callback methods registered to this event should have an EventBase parameter and return no value.

Additional resources: Clickable.clicked

 public VisualElement CreateButton()
 {
     var button = new Button { text = "Press Me" };
     button.clickedWithEventInfo += (EventBase evt) =>
     {
         int clickCount = ((IPointerEvent)evt).clickCount;
         if (clickCount == 1)
             Debug.Log("Button was single-clicked.");
         else if (clickCount == 2)
             Debug.Log("Button was double-clicked.");
     };
     return button;
 }

Did you find this page useful? Please give it a rating: