Left Mouse Button Event to spawn ParticleSystem

I’m simply trying to spawn a particle system in the game space when the user does some mouse input.

The problem is the Left Mouse Button event isn’t firing in my GameMode or PlayerController (tried both).

I also don’t have any actor I’m interested in activating this with, I just want any click to spawn the particle system.

Edit: It’s probably because I’m placing the Blueprint event in GameMode and/or PlayerController?

Edit2: I found this in the documentation which solves my issue, but I was hoping I wouldn’t have to recreate the blueprint code in each level for the click event.

Use Blueprint scripting (either within the Level Blueprint or any Actor Blueprints) to process mouse interaction.

Edit3: So now I’ve attempted to get onClick events to fire for the Box Trigger and Trigger Volume but I’m unable to receive any events from them as well.

Edit4: So I added a Mouse Right Click event to the level editor; that triggers, and Mouse Left Click doesn’t.

Anyone willing to explain why, or what kind of gotchas there are here, no idea what’s going on now.

can you provide a snapshot of your code

Alright so by default nothing but your player controller and player character receive input and having input directly inside of your gamemode is pretty bad practice anyway because if you would ever decide to go multiplayer you will have to completely rewrite that.

However that it doesn’t work in your player controller as well is rather strange. Have you selected the player controller in your gamemode? Or is that still using the default? Because that would mean you don’t actually have the new code running when testing.

And as last little tip. Don’t use those static events like (Left Mouse button) or (Space Bar). Go to “Edit”, “Project Settings” and under “Input” you can define input events. But instead of just having a single button you can use there, you can add as many as you want. This allows you to enable gamepads without near to no additional work, it allows you multiple bindings and eventually fairly easy key rebinding (though not in BP only as of yet sadly).

I hope this helps a bit. I am absolutely unsure why it would work with right but not left click. Maybe a look at your setup would help but it seems rather strange.

Cheers

I created a fresh project today to see if I could recreate my issue, I couldn’t.

So a fresh day, I went back in to the code and started to clean up.

I had a few extra classes that weren’t in use I removed. I unset the value “Automatically use input from player_0” on a few items, retested and left click works again.

Yea, I had it enabled in the game mode, I really have no idea what I changed that made left click fire alongside right click, because I went back and tried to check the things that I unchecked to no avail.

I have no idea what happened, what caused this, I’ll just move on and hope I don’t run into it again.

So I can mark this as answered, what blueprint node should I use to spawn anything at the location of the mouse click.Convert Mouse Location to World Space?

My desired outcome is to just place something visually where the user clicked, but in the world, it’s a 2D game so all/most objects are clamped to the Y axis, so that makes it easier, hopefully.

I would if I thought it would help, I’m pretty sure it’s a check box or setting somewhere I’ve missed or in my case enabled when I shouldn’t have.

Well there are two possibilities to do that.

“Convert Mouse Location to World Space” and “Get Hit Result under Cursor”.

You can try both and look if that fits your needs. Everything else is quite a bit harder and pretty much involves you doing everything by hand.