Key bindings to f(x)s work in main level but not blueprint

I’m making an audiovisual piece with cubes; basically, I have the main level, the visualizer and the cube.

In my “main level event graph” I can get “k” to toggle the visibility of an object. This works (just going deep into into components):

In my blueprint of the actual item I want to toggle on and off (the cube), if I connect “toggle” to event play, it’ll toggle off the visibility. It accepts keys, bc I can get it to print a “hello” from there as well, however, I can’t seem to get a key press to do “anything” to the item itself from within the blueprint. This doesn’t work:

It’s pretty weird to me. On tutorials it looks like people do this easily all the time. What am I missing?

  • regular actors do not process input by default, it’s disabled and for a good reason. Can be enabled, though:

  • input consumption is a thing, a key-press can be processed only once by default:

image

Whoever gets to it first, consumes it. Input Priority (1st pic) allows for more granularity in case you there is more than 1 actor competing for it during Input Component Checks:

image

Does any of the above help?


It accepts keys, bc I can get it to print a “hello” from there as well, however, I can’t seem to get a key press to do “anything” to the item itself from within the blueprint. This doesn’t work:

That does not seem right. If you can Print using L in the actor, it should fire toggle, too. What are the chances there is more than 1 actor with that toggle?

1 Like

Thanks so much. I did enable input on the actor/blueprint. Set it to player 0, etc.

Also consume input is set to true.

What I was trying to do was make it so that every actor of that class in the scene, when you press k, would hide e.g. a particle system. Right now, is only one actor consuming the key press? Is that why it’s working when I set it on the level, but not at the actor? Setting it at the level is fine, it’s just a pain going through all those parent/childs to hit the right object.

There are many actors with that toggle, but I want to shug them all off…

So, yeah, it’s firing to print, but not firing to toggle visibility, which to me seems bizarre, right?

What I was trying to do was make it so that every actor of that class in the scene, when you press k, would hide e.g. a particle system. Right now, is only one actor consuming the key press? Is that why it’s working when I set it on the level, but not at the actor? Setting it at the level is fine, it’s just a pain going through all those parent/childs to hit the right object.

There are many actors with that toggle, but I want to shug them all off…

Makes sense. Disable consumption and all actors will be able to fire L:

image

This is not very elegant, though. Ideally, we’d have the L in the player controller only and handle it all there. It can be the Level Blueprint but that’s not really how UE4 wants you to do it.

Setting it at the level is fine, it’s just a pain going through all those parent/childs to hit the right object.

Not sure I follow, it seems that you could GetAllActorsOfClass (or tag) here and fire what is needed in the loop, no?

  • this in the actor:

image

  • and in the entity that does the input processing:

Now it’s somewhat neater. And you know where to look if input misbehaves since it’s handled in LB only. Just make sure the actors can no longer process it, they shouldn’t really, unless you’re after some sort of uncanny puzzle game.

This was all so helpful! Thank you so much! I got everything working.

Thanks Everynone,

If you ask me this is THE first and largest hurdle for new UE devs.