activating the click event of the button without clicking the button

enable button click event without pressing the button
is that possible if possible how do i do?
Can you explain with sample codes?
6741043--776845--upload_2021-1-19_19-3-0.png

6741043--776845--upload_2021-1-19_19-3-0.png

6741043--776845--upload_2021-1-19_19-3-0.png

6741043--776845--upload_2021-1-19_19-3-0.png

Get a reference to your button, call Invoke() on listeners.

{
    ...
    myButton.onClick?.Invoke();
    ...
}

“?” is a cleaner way of doing a null check. Invoke() is calling all subscribed methods.

1 Like