- Home /
if collider is disabled can i check click event on that gameobject?
Run time i am disabling gameobjects collider. Now when the collider is disabled and if i click on that gameObject i want to show some pop up message like "Error".
Is it possible?
Why are you disabling the collider? To let things pass through it, or to click on things behind it, or ... ?
As diggerJ writes, you need some sort of collider to get the click. So, depending, it might be possible to not disable it, but just "turn off" one part of it. Like, sometimes setting isTrigger
is a cheap way to only physics-disable.
Once i click on that gameObject a pop up comes... So if that pop is active i don't want the user to click the gameObject... Once the pop gets closed i want the collider to be active again.
So if pop up is active & if the user click on that gameobject i want to show some error message
Oh, well that's just a basic program$$anonymous$$g problem. Ins$$anonymous$$d of disabling the collider, set something like usingPopUp
to true. Ins$$anonymous$$d of re-enabling it, reset usingPopUp
to false. Then, for each click, give the error/ignore if usingPopUp is true.
A first semester program$$anonymous$$g class usually shows this trick (using flags) midway through.
Answer by diggerjohn · Jan 31, 2014 at 10:27 AM
I believe you would still need a collider to register a click, mesh or box or capsule.
Your answer
Follow this Question
Related Questions
How to use a Raycast to see the distance traveled within a collider. 2 Answers
Move player to specific location and avoid obstacle. 2 Answers
Im trying to create a word game with a twist 0 Answers
Raycast not detecting ANY HITS AT ALL when starting inside a collider. 0 Answers
ball sometimes goes through the bat when hit... collider problem... How to do a Raycast? 0 Answers