Get Hit Under Cursor only returning static mesh not the actor


I have the above set up which works perfect in a different 4.2 project however this is 5.(current).
The actors are children of the “base_pipe” actor and so this cast should work.
When I look in the hit results i can see the hit component is the static mesh but it would cast.
Help pls.
Thanks

What actor are you hitting then?


The only actors in the level are pipe actors. The on hit shows the static mesh that is part of the pipe but wont cast to pipe

  • print the Display Name of the actor that you’re hitting, what do you get, does it add up?
  • compare the hit actor type to what you cast to; what do you get?

What are the chances you’ve dragged a static mesh into the persistent level - this would create a Static Mesh Actor with the respective component but it will not be the Base Pipe. Hence my original question - what actor are we actually hitting?

1 Like



So I have the printed out the hit actor name within the UI. The name is BP_Straight_C_1 (These actors are spawned when the game is powered up) I have tried to cast it to the BP_Straight actor (which is a child of the Base_Pipe actor) as you can see it still fails maybe I should get the actor by name from the world and then cast to?

Nah, there’s mix up with the classes on your end.

  • try this:

Find that BP class in the Content Browser, open it and do tell what it says in the upper right corner:
Parent Class: ???


works perfect in a different 4.2

Also, could you clarify this part? Is this something that you auto-converted from an ancient 4.xx version. 4.2 was 5 years ago…

If you’re 100% certain you cannot cast to the type you’re hitting, something much stranger is going on here.

1 Like

Screenshot 2024-08-07 153644
Ok so…I had everything being created in the player pawn rather than the level.
I changed it all to be in the level blue print and it works now. apologies for wasting your time and that you very much for your help.

1 Like

No worries, I sensed something uncanny as what you tried doing should generally always work.

Good luck with the rest!

1 Like