Set Array Elem - HELP!

Can someone explain what I am doing wrong here? I try to get each released single and update the sales, which essentially works. The problem here is with the Set Array Elem node. It does not change anything. However, when I do this on the player character itself, the info updates no issue.

Can someone explain why it is no working? I’m far from being a beginner or an expert in UE5. I will provide any additional info as well. Thanks in advance.

Hey!

Could you compare the Single Info which you get from the second For Each Loop with what the function Update Streams Pure Sales SEA For Single returns? The Set Array Element node should be working, but perhaps your function which updates the sales isn’t?

What I mean is, that you could be getting an array element and setting exactly that array element back into the array and at the same index, essentially keeping the array exactly the same.

1 Like

Array Element on the ForLoop is a copy of the struct not a reference. You need to re-add that struct to the array. Also the break node is giving you a copy, you’ll need to set it as well before adding it back to the array.

You’ll need to :

  1. Store the array returned by Break ArtistDiscography in a local variable.
  2. Loop through that variable, call the update function, set the array element.
  3. Create a Make ArtistInfo node, Connect the Local Variable to the ArtistDiscography pin. pass in any other data from the initial Break ArtistInfo as well.
  4. Use that make node as the input in another Set Array Element to set element in the ArtistDatabase array

Somewhat accurate graph I made with the limited info:

I think that should work? maybe…

3 Likes

Yes, someone else said pretty much the same thing! The array was nested (array within array), so not only did I need to update the Released Single struct, but I also needed to update the Artist Info in the database as well. Thanks!

Essentially you are correct. I was only setting the Released Singles in the array, but not updating the Artist Info in the database as well. Thanks!

Is the Set Members node I added necessary? I still am learning about references, and the diamonds vs circles, etc.

Diamond usually represents a Reference, Circle a Copy.
In the screenshot it’s not necessary, you’re just passing along the struct. Set member is useful when you want to directly set something in the struct without copying it. In your case I don’t particularly see anywhere you can use it since you have to loop through an array of them.