Ok, so this is probably something really minor, but I’ve spent a few hours on it now and can’t seem to figure out what I’m missing!
- Create new C++ puzzle template (my prototype is based on this)
- Create new blueprint Actor
- Add Sphere shape as component, set it to visible in game
- Add OnClicked event in the Actor’s Event Graph, just wired to print string
- Add blueprint actor to scene
- Play and click Actor’s sphere component
I’ve messed around with this a lot, and it seems to me this super simple setup should call OnClicked, but I’m not seeing any of the input events called for any component in a blueprint Actor, regardless of if I spawn it in blueprint, set it to enabled, or set input enabled from player controller.
Really stumped… what am I missing guys?
Did you select a player for “auto receive input” in the “Default” section of the blueprint ? In a single player set it to “player 0”
Nope, had already set that. Looks like it’s an issue with component type, see my answer
So I was thinking, obviously onClicked works with the static mesh cube in the puzzle example, so what if I added a static mesh component to my blueprint? And wallah, it worked!
Still seems pretty strange to me that a sphere shape (the bounding sphere that I would expect to be designed for collision, including clicks) doesn’t work. And it didn’t work for me with a skeletal mesh either, although I suspect this requires further bounds configuration like you do for a player controller (this was just a skeletal mesh in a blueprint Actor).
For now I’ve made a low-poly sphere static mesh and added it as a sub-component to my skeletal mesh, with its visibility off. With this setup, clicks inside the invisible sphere mesh fire both sphere → onClicked and actor → onClicked, so problem solved.
Anyone know why the other component types don’t work as I expected? I’m running 4.3.1
As answered by Ben Halliday(in my question) simple go to your skeletal mesh, right click it in the content browser then click create physics asset, then it will work without need to add a hidden static mesh , tell me if it works!
It does have a physics asset already setup…
I had this issue (onClicked and similar events wouldn’t fire on one specific actor blueprint when other actor blueprints with different meshes worked fine). Here’s the solution that worked for me:
Note that you must open the static mesh asset to view this setting. So, double click the static mesh in the content browser to open its details. Selecting an instance of this mesh in the level will show you the details for that instance, which does not include this setting.
For those who tried everything mentioned but OnClicked still doesn’t work:
Make sure you don’t have hidden widget on the HUD. It will purge OnClicked event. Make blocking widget SelfHitTestInvisible.
bResult = PlayerInput->InputKey(Key, EventType, AmountDepressed, bGamepad);
if (bEnableClickEvents && (ClickEventKeys.Contains(Key) || ClickEventKeys.Contains(EKeys::AnyKey)))
UGameViewportClient* ViewportClient = CastChecked<ULocalPlayer>(Player)->ViewportClient;
if (ViewportClient && ViewportClient->GetMousePosition(MousePosition))
UPrimitiveComponent* ClickedPrimitive = NULL;
ClickedPrimitive = CurrentClickablePrimitive.Get();
const bool bHit = GetHitResultAtScreenPosition(MousePosition, CurrentClickTraceChannel, true, HitResult);
ClickedPrimitive = HitResult.Component.Get();
//2F:THIS IS WHY YOUR CLICK EVENTS ARE BUGGED
if( GetHUD() )
if (GetHUD()->UpdateAndDispatchHitBoxClickEvents(MousePosition, EventType))
ClickedPrimitive = NULL;
bResult = true;