I hope to report a bug here which was bugging me today (pun intended). This is what happens:
I want to create a little inventory system using only Blueprints. The items to collect all have a struct, containing their name, description, image etc. Additionally I have a UMG widget, which should show the collected items on-screen.
Unreal crashes when it tries to bind the name from the struct into the widget label, or at least that’s how it seems.
Maybe you already know about it, or maybe it’s just my fault, but I created a little video for you anyway, since pictures say more than a thousand words. In the video, I reproduced the bug in a clean project. Log file is attached as well.
I can’t remember this behavior to have occured when I used UMG last time (I think it was in 4.6). I sincerely hope you can help me out here. Thanks in advance!
Okay, it seems that your items array contained some invalid elements, and this was causing you to get some zeroed memory back, later resulting in a crash. I’m going to double check this with the Blueprints team as returning zeroed memory for non POD types can be pretty unsafe.
I’ve managed to address this by adding an IsValid check in the Get Info From Items function of your BugController blueprint.
Your invalid items may well be due to your BugItem blueprint destroying the actor that you’ve just added to your inventory. It seems you only need the info from these actors, so it may be better for your inventory to store an array of infos, rather than an array of actors.