Actor/component cursor over events not firing

I’m trying to change the value of a variable when the cursor moves over or off of an actor, but I’m having trouble getting the On Begin Cursor Over and On End Cursor Over events to fire.

For my setup, I’ve:

  1. created an actor containing a Paper2D TileMap, a box collision component, and a few Paper2DGroupedSpriteComponents on which I’d like the events to fire. I don’t care if its target is the actor itself or one of the components.
    component-tree

  2. set the Player Controller’s Enable Mouse Over Events and Enable Click Events variables to true in Event BeginPlay in the Level blueprint.

  3. bound custom events to On Begin Cursor Over and On End Cursor Over in the actor’s Event BeginPlay (which never fire).

  4. created similar On Begin/End Cursor Over events for the actor’s box collision component, just to see if it works (it also doesn’t). See above picture.

  5. confirmed that the mouse gets a hit result by using Get Hit Result Under Cursor by Channel targeting the visibility channel during the actor’s tick event. The result of the final Print String in this diagram is TileMapBlueprint.Box.

  6. set the GroupedSpriteComponents’ collision settings to No Collision and ignore all collision responses.

  7. set the actor, box collision component, and renderer component’s collision settings to BlockAllDynamic. (All 3 are the same).

  8. created a PlayerPawnController that automatically receives input for player 0 with input priority 0.

I’m relatively new to Unreal Engine, so I feel like I’m missing something simple or doing something silly. Does anyone have an idea why these events won’t fire?

1 Like

Could you try it without the widget getting in the way, just in case:

image

Could you also confirm that the Player Controller is using those settings:

image

I know it says Click but it’s actually responsible for actor / component mouse over events as well.


Not that it’s relevant here, but you can:

instead of dynamic binding, similar to what you already do with the component.

2 Likes

Thanks for the response. I tried with and without the HUD widget that’s being added. All widgets (except for one button in the corner) have their Behavior > Visibility set to Non Hit-Testable (Self Only).

I’ve confirmed that the Player Controller’s settings match those you’ve posted, but that hasn’t changed the behavior:
player-controller-settings

I love the override function. While it didn’t change the outcome, it made that section of my blueprint much cleaner. Thanks for the suggestion.

Any other ideas about what could affect these events or how I could troubleshoot?

The thing is that the setup seems fine and covers pretty much all there is to it.

  • :white_check_mark: enable mouse over events in the controller
  • :white_check_mark: ensure the target blocks (at least query) the channel defined in the controller (Visibility by default)
  • :white_check_mark: no other stuff gets in the way
  • perhaps that’s is, perhaps it consumes is before it can reach to box? Feasible?
  • we can’t see your scene but is 100k trace distance enough? That’s 1km.

Thanks for the response. I tried with and without the HUD widget that’s being added. All widgets (except for one button in the corner) have their Behavior > Visibility set to Non Hit-Testable (Self Only).

Somehow my mind still gravitates towards the widgets being the culprits, the behaviour fits the bill.

  • open any widget and run the reflector:

  • pick hit-testable widgets:

image

  • green frames everywhere, run the game, mouse over stuff
  • what do you get when you mouse over the offending box that refuses to be interacted with:

If you see sViewport while the cursor is over the box, no widget blocks the trace.

1 Like

I’ve set the Render Component’s collision enabled to No Collision and to ignore all collision responses–no change, unfortunately.

Edit: As a side-note, changing the Render Component’s (the root component) collision settings changed the actor’s collision settings as well. I’ve reset it, but it doesn’t look like I can change one without changing the other.

Everything in my scene is happening in a small area (< 200 units), so the trace distance should be more than enough.

Are there other things I could do to troubleshoot to see if something unexpected/invisible is getting in the way or make sure that none of the settings in my compiled blueprints are being changed unexpectedly at runtime?

This is beautiful. Thank you. Checking now.

Here’s what I’m seeing when I mouse over the TileMapBlueprint actor. It looks like nothing is blocking the trace.

At one point, this functionality did work, but I’ve changed a lot since then and haven’t tested this cursor over again until now. I did recently upgrade my project from UE 5.3 to 5.4. This hasn’t had any negative effects that I know of, but it may be relevant.

I’ve started investigating the cursor’s behavior in other long untested parts of my blueprints, and I’ve noticed even more weird behavior. Can you make sense of this?

The boolean variable I’m trying to set governs whether the player is currently dragging a tower around on a tilemap grid. After manually setting the variable to to and dragging a tower around, it only follows the x coordinate of the mouse. The red X is the position of the mouse. The tower itself should be green based on the position of the mouse. Towers hovering over the gray edge blocks should be red:
not-following-mouse

This is the end of a function that actually converts the cursor’s screen coordinates into world coordinates that can be used to set the position of the tower so it follows the mouse.
without-print-statements

When I added Print String statements to see what the output of Get Tile Coordinates from Position, however, the dragging behavior returned to normal:
following-mouse

Here’s the same function with print statements:

I feel like this is a clue to the solution for the original problem, but I’m not sure what it’s telling me. Do you know why a print statement could change the dragging behavior?

It doesn’t, it can’t. Yet here we are. I honestly cannot tell why you observe the behaviour. Perhaps I’m not the best person to chip in - there might be something about 2d I don’t know - not my domain at all.

I spent some time to create an entirely new project and recreated everything from scratch, and all mouse events work now. I tested after adding each blueprint and asset, matching every setting from my old project, and I was unable to find anything that broke user input. I can only guess that the upgrade from 5.3 to 5.4 did something I probably won’t understand without a much deeper dive into the engine code.

My main lesson here is that before an engine upgrade, have a comprehensive manual test plan that focuses on blueprints and any other actors, properties, and interactions that are managed within the editor. Don’t continue adding functionality without fully testing all the features in your game and confirming all expected behavior.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.