- Home /
deactivate object when click anywhere else
I want to do something like that: there is a grid, and there are cannons on it. I want to make it so that when I click on one cannon it activates and then I can shoot with it by pressing space (shooting is already done) as well as it deactivates whichever cannon that was previously activated. So that only one cannon is active at a time. And if I click somewhere else (not on cannon) it deactivates all cannons.
Answer by jayant_vishwakarma · Feb 05, 2018 at 01:42 PM
You can use queue or list to de-activate previous GameObject(Cannon). but if you want to make it in easy way just deactivate all the cannon when you click on cannon or anywhere else and re-activate just on cannon.
Your answer
Follow this Question
Related Questions
How to make when object is pressed, object2 does something? 0 Answers
using mouse to move an object 2 Answers
[Bug?] int parameter on dynamically added onClick-Event is wrong 1 Answer
Button UI, OnClick() - Calling Bool Function 1 Answer
More than one Button Onclick instruction causes the script to run as many time 0 Answers