How to create interactivity with a key in Paper2D?
So, my issue is that I want to make it so when my player walks in front of something I want the player to interact with, they can press a key, say [E], or in this case, [X], and I expected this to be a straight-forward process, but for some reason the system doesn't work the way I want it to, and I'm not too sure why. I've tried checking tutorials and other questions asked on the hub but all of them seem to be for such specific situations that they haven't been any sort of help. So, here's my blueprint, and my thought process.
So, when the player overlaps with the blueprint, which is in the place of the desk, (and also aligned with the players' position, that was the first thing I checked.) it then opens the gate that leads to the textbox widget that should show up when you interact with it. So, after the gate is opened, pressing [X] should enter the gate, and since it's now open, it should also exit the gate and add the widget, correct? I believe this might be an issue with the X input because everything else works perfectly, perhaps I'm not supposed to set up the input there?
If anyone can help me figure this out, I'd really appreciate it. Thanks in advance!
asked Jan 28 '19 at 03:54 PM in Blueprint Scripting
I would go about this differently, I would use Interfaces so you can then interact with any object you wish using X and change the code accordingly. A good UE4 tutorial can be found here.
When looking at your code:
I would first debug it by watching where the execution is going/isn't. Also, I believe the Keypress logic you are doing is in the object so you would need to enable your Players Input by doing:
I recommend doing Interfaces, however, try the following if you need it to work and update with more information on where the execution is breaking.
answered Jan 28 '19 at 05:11 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here