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:
input consumption is a thing, a key-press can be processed only once by default:
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:
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?
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:
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?
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.