What is the best way to use buttons?

I’ve created some buttons in my scene following a tutorial, but, I saw that in the script it use an ‘OnMouseDown’ method, but I need to add a collider to make it works. But, I the button have a click events to create that actions too, So, what is the correct way?, is common to use both ways ?

The “general” or “correct” solution would be to use the input system’s axes. They get direct control from the Input Manager, where users can customize buttons. That way, you don’t have to specify “this mouse button” or “this key”.

Defaultly, you can check for if the left mouse button was clicked with:

if(Input.GetAxisRaw("Fire1") == 1) { }