Key Must be Held to Exit Menu

In 4.7, the following piece of code would remove my inventory menu from the viewport instantly when the “I” key is hit with the menu open. However, in 4.8, this behavior seems to have changed such that, while focus is indeed lost, the widget will not disappear and return control to the unless “I” is held for about 2-3 seconds.

Similarly, not releasing “I” after opening the menu will cause it to close again after 2 seconds. On a somewhat related note, while, the 4.7 version allowed the Esc key to be listened to in widgets, in this case providing an alternate means to removing the inventory menu from the viewport. However, 4.8 seems to just treat the Esc key as normal, causing the game to exit.

Hey Renkin42,

Did you package your project to test the ‘I’ functionality? Also, when you’re pressing escape, are you pressing escape within the editor, after launch or once the project has been packaged? If this is happening after your project has packaged, could you please provide me the full steps you’ve taken to package your project?

Could you also please try this in 4.8.2, or is this the version of the editor you’re reporting? We just had a new hotfix released today, which is why I ask.

Looking forward to hearing back from you, thanks!!

I haven’t tried packaging yet, jus play in editor. I’ll try that when I get home and get that copy updated and get back to you. And yes, this was in 4.8.2.

Great, let me know how this works out for you.

Had to go ahead and make a new project, as packaging the main project was taking too long. Anyway, the “I” behavior was identical between the play in editor and the packaged versions. Curiously, the packaged version responded to the Escape key exactly as intended, removing the widget instantly.

To package, I just went to File > Package Project > Windows > Windows (64 bit), set the destination to a folder on my desktop, and let it do its thing.

Since creating a new project, the escape key is now working correctly? However, you’re still experiencing trouble with your inventory actually opening when pressing ‘I’?

I have not noticed a delay in opening and closing the inventory by using ‘I’. Would you mind uploading your blueprint for me? You can easily zip it to your next reply.

Thank you!

Sorry I wasn’t quite clear, in the new project, the Escape key behaves as before in PIE, however it behaves correctly when packaged. Throw [these][1] in a first person project, should work.

50363-widgetblueprints.zip (27.6 KB)

Hey,

Thanks for providing me with those files. I’ve placed them into a First Person template and unfortunately, it caused a little issues however, I was still able to open up the blueprints and replicate them. Upon doing so, I noticed the following:

  • The escape key works quickly and takes you out of PIE immediately, rather than having to type ~quit
  • I also noticed that pressing the assigned button ‘I’ worked quickly as well. There as no delay.

Have you tried completely recreating the blueprints from scratch to see if upgrading is the issue here?

The Escape key behavior is the same as I was describing, it only changed in the packaged version. I did recreate the blueprints when creating the new project, so that isn’t it.

Hey Ren,

Could you please provide me a detailed list of steps in order to reproduce the issue that you’re running in to? Sadly I haven’t ran into what you’re describing and I’d really like to make sure I’m not missing a tiny step here or there.

I appreciate your time and assistance with this matter. :slight_smile:

Sorry if this is a bit more specific than you were wanting, just covering all the bases:

  1. Open Unreal Engine 4.8.2 From the launcher.
  2. Create a new first person blueprint project
  3. Create a basic widget blueprint with something in it to make it visible.
  4. Override the “OnKeyDown” function and recreate the blueprint above.
  5. Create a custom player controller blueprint.
  6. Use the controller’s “Begin Play” event to construct the widget and promote the reference to a variable.
  7. Add an “I” input event to the controller and, from it, add the widget reference to the viewport. Set the controller to input mode uionly with focus given to the widget ref.
  8. Modify the gamemode to use your custom controller
  9. Play in editor to confirm the following behavior:
    1. I opens the widget
    2. I must be held to close the widget, otherwise it loses mouse focus without closing until I is held long enough.
    3. Holding I when opening widget closes it shortly afterward.
    4. Escape exits PIE rather than simply closing the widget.
  10. Go to File > Package Project > Windows > Windows (64 bit)
  11. Play packaged version and compare behaviors.

Worth mentioning that the original project didn’t follow those precise steps at all, so it shouldn’t be that specific. The only similarities would be that both were in 4.8.2, though the original was converted from 4.7.6, both were based on the first person blueprint project, both used the same key to both open and close the widget, though the original used I for inventory and C for crafting (both behaved the same), and the blueprints to add and remove the widget were the same.

Hey,

Thank you so much for providing such detailed steps, I really appreciated it. It looks as though I missed a couple of steps along the way. I have been able to reproduce what you’re seeing and I have submitted a bug report to our developers. If you’d like to check on this report in the future, please reference: UE-18809.

I will update this post as I hear more information, let me know if you have any further questions. Thanks!