So in my game you can punch by left clicking.
However you also have to click doors to open them and click items to pick them up.
This means everytime u open a door or pick up an item you punch which is very annoying.
Is there anyway to check if a player is hovering over a click detector? Maybe detect the cursor icon itself changing? since it changes when your hovering over something you can click.
You can use the MouseHoverEnter and MouseHoverLeave events of the click detector to do this. An example would be to set a boolean value to true on MouseHoverEnter, and false on MouseHoverLeave. Then, simply check for this boolean when attempting to punch.
Good point. I searched up a couple posts about this, and it seems that (from what I’ve read) on mobile you will need to tap a ClickDetector twice in order for it to trigger. After doing some tests, I’ve discovered that on the first tap, MouseHoverEnter fires. If you tap somewhere else other than the click detector, it will fire MouseHoverLeave.
How about this… the click dectector hover creates or updates a value in the character, maybe a bool, call it mousehover. Have the click detectors set mousehover value to true/false when it detects. Then, have your punch script check the value and only punch if mousehover.Value == false.