Does anyone know a workaround for this bug? Can not set data in arrays of user defined structures - Programming & Scripting - Unreal Engine Forums
I have an inventory system that is basically an array of container structures. Each container has an array of items structures inside.
It seems that I can’t change anything inside the array of item structures. Does anyone know of a way to get past this bug and have the same result?
If I understand your issue, I may be able to corroborate it. I had a TArray of structs I was using in Load and SaveGame for my item inventory. The weapon inventory then had, within each struct, an array of structs to hold various weapon attachments, each having a struct of values for the attachments such as damage, range etc multipliers. After a few wasted days of trying to make it work, I bagged it and created monolithic uniquely named slots at the top level struct which made for a lot of unnecessary and repetitive code, but it worked and I moved on. Terribly poor solution, but the structs with structs would not work as expected for loading and saving. I did no tests to see if it work in any other context.
I may just result to doing exactly that. It might work better for what I want anyway.
I’ll turn that into an “answer” if you think it is. I’d like for UE Staff to check it out though. It would be far more elegant style-wise to nest tarray structs 3 levels deep. I would think this should have been posted in Bug Reports to see if they could confirm or deny it. I never reported it.
This is something like what I’ve been trying to do. Thanks for the answer. Ill try this out.
Alright, so my inventory is slightly more complicated than this. Instead of having a set place where the found item will go, the found item can go pretty much anywhere within any of the arrays. This is where the problem is made. The only possible way that I see of doing this is to go through 1 by 1 and make a new variable for each item in the first array.
Edit: After further testing, I couldn’t even get what you have to work.
They have known about the issue, but apparently a fix isn’t coming for a while.
Does anyone else have a possible solution to this? I still cannot get it to work.
So I have been working on an array. On this one I have done many checks and I found that on the “Get” node for the array there is a input as integer and then an output as text. When the input on integer is 0 the output is working as correctly. When the input is 1 or higher the output is always blank when the array coming in is not. I found the problem to mainly be with the get node not working with integers higher then 1. I want to know when this problem is fixed, If someone has already posted a bug report, then do I need to post one as well?
I have done this with text variables,(Save your array.) is convert them to string(This works for text variables. You might use float for integer). Change the name, then back to text again (The variable you were using).
1 Save you array somewhere, keep the elements.
2 Change array variable to something similar.
3 Change the name of the array.
4 Change the array back to what you want.