Working with the Key Structure type is causing endless crashing!

Instead of making 10 different InputAction events for each of the # keys to select control groups in my RTS game, I figured that I could try to do a string switch on the Display Name of the key that was pressed.


The above InputAction has ten keys that can trigger it: 1 thru 0 (with the Ctrl modifier activated). For some reason, though, you guys don’t allow me to do a switch on which key was pressed. So I tried to get around it by doing Get Display Name → ToString(text). Since you guys allow me to do a switch on strings, I figured that this was a good idea.


Unfortunately, though, this has led to the PlayerController telling me that compilation was “dirty”. Furthermore, when I press the buttons that call the above function, the engine crashes every single time! Even trying to do a check on which key it is actually equal to (so that I can just do a chain of if-else statement branches rather than a simple switch on string) still results in a dirty compilation as well as engine crashes!

What makes this even more weird is that it actually worked fine for a couple hours before the engine started crashing! Digging around and debugging what I’ve done has led me to this Key Structure as the culprit.

What should I do and how can I solve my problem without crashing the engine and getting dirty compilation?

As a follow-up to this, I just tried doing the same thing in a new, clean project and there is no problem with dirty compiling.

What the hell is going on?

Hello,

  • When your editor crashes, are you getting a crash reporter window? If so, could you please provide your machine id, and ensure to hit send on the crash report?
  • Could you provide the logs from your project’s Saved->Logs folder?

My Machine ID: D8EF7BC449D9DBDB11F0A2812307EB09

I have made sure to hit send each time that this crash has happened. Sometimes I even left a comment or two.

As for the logs, I’m not sure which ones are relevant (there have been many crashes over the past week for various reasons), but here’s one of them, dated a couple,hours before the time that I made this thread: http://pastebin.com/MEz51PRh

edit – also, I want to add that I have refactored everything about control groups and have gone about it in a more “brute force” way, where I have 20 direct key input presses and use manually entered integers as the function argument. It works fine, but it’s ugly and I wish I could have done the “switch” way, which would simplify this whole thing substantially:


edit^2-- also, thank you for paying attention to me

Could you cause the crash to occur again and copy the callstack into your response? I am seeing quite a few unique crashes related to your project, and I’d like to know which one we are focusing on in this post.

Hello,

I am marking this topic as resolved for tracking purposes, as we have not heard from you in a few days. If this issue persists, feel free to respond to this thread. For any new issues, please create a new Answerhub topic.

Have a great day

Hi, i find the same issue with all functions using the key structure. Maybe the problem is that the structure is empy, if you put a break struct dont appear any member

110562-breakkeystructtext.png

Hey vixxvix,

If you’re looking to check for multiple different inputs and switch based on that, this answerhub thread displays a good example of how to do this: https://answers.unrealengine.com/questions/342941/create-key-struct-to-check-key-pressed.html

Let me know if you have any further questions. If you are experiencing any sort of crash related to your setup, please open up a new Answerhub thread so we can investigate the issue separately.

Have a great day