Hi i have 4 buttons that all use the same function but with different gameobjects:
public void BuildShip(GameObject ship)
{
Instantiate(ship, mousePos, Quaternion.identity);
}
I know how buttons work and how to call a function with them, however i want to know how to check if that certain button has been pressed. How do i see when OnClick() has been called when clicking the button? How can i use it in a if statement?
What i wanna do is: See if a certain button has been pressed, lets say button2. When button2 has been pressed i wanna for example change a int or call a debug.log etc. Im pretty sure i want to use an if-statement which is called everytime i press the button or i can have a loop to check all the time when a certain button is pressed.
But for now to simply answer this question: I want to know how to see if a button is pressed and how i can check this with the help of an if-statement.
Thanks.