- Home /
How to make unity expect a click
Hey guys, I'm making a game and i need to perform different action on the click event depending on what button was previously clicked. Is there some way to make unity expect a click. I dont know any right (the way i did, didn't seems to be right. I've made something like using a switch case and the button chand the compared number value ) to do so and i couldn't find questions like mine, but if there's some right way or a similar question please tell me
You can add a string variable to your script and change it at every click to store the name of the click. Then do a switch case on this variable when you click. Not sure if it's very clear ^^
This very much alike what I'm doing now. I've already figured out an other way. But still not what I want
you're gonna have to remember which button was previously clicked OR make a method that forces you to to press another button.
I suggest making a variable "PreviousButtonClicked", when you click the next button, you can compare and do your game logic.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Click a Button through a script 1 Answer
Distribute terrain in zones 3 Answers
Trigger a Button Click 2 Answers
How to implement Clicking in Unity-GearVR by pointing Light??? 1 Answer