How to press a button via unity event or code

Justus

Member
I want to let the MainButton in the QuantityPickerPanel trigger the confirm button directly.
but I didn't found related function to do that in ActionButton.cs
maybe we could change `Press()` to a public virual function?
1652500298070.png1652500437425.png
 

Sangemdoko

Moderator
Staff member
Normally you would call OnSubmit, like on a regular button.
But I guess you can only do it through code.

I made Press public virtual for the next update
 

Sangemdoko

Moderator
Staff member
You can call actionButton.OnSubmit(null) or actionButton.Press()
You'll probablly want to set the "m_UnselectedPressSelectsAndPress" field to TRUE such that the action gets called even if the button is not selected.
Or you can call actionButton.Select() before sumbit ot press
Feel free to have a look at all the public functions on the ActionButton script you mind find some other interesting things you can do.
 
Top