Download

OnBeginCursorOver Function Not Working

I am working on a Top Down game and want the enemy’s health widget to appear when the mouse is hover it. I can’t seem to get the blueprint to work. I attached a screenshot of my blueprint setup.

If I had to guess you either have something in front of the actor blocking it, or collision types may be wrong. I’m not at my computer at the moment so I can’t verify this, but I think you need to Block Visibility in collision to receive mouse interaction responses.

You’ll also want to add checks to make sure the widget hasn’t already spawned, and possibly destroy it when cursor leaves the area of desire. Otherwise you’ll just end up with a ton of stacked widgets.

You could use a bool, or get all widgets of class to see if one is already spawned, or saved spawn widget to a variable and do a check something like…

If SpawnedWidgetVariable == ObjectNothing Then: Spawn Widget, set SpawnedWidgetVariable.

It’s cheaper to use memory to store information rather than do excessive checks in programming these days.

Thanks for the reply. The actor has several components to it (rotation, pawn sensing), so I attached the function to the mesh. Would this cause any issues?

Collision should work the same on just about everything, so while I have only made 2D games I still don’t see that being an issue. Did you make sure you had visibility set to BLOCK in the collision settings?

I ended up setting ‘Collision Enabled’ to ‘Query Only’ and this worked. Thanks for the help!