[Arrays] "Remove Item" is not removing an actor from my array?

In my game, I pass an Actor and a Structure to a custom event. This looks through an array of Actors, and if it finds a copy of the input Actor, removes it. Buuuut, for some reason it doesn’t work.

I’ve verified that the input Actor IS on the array checked (index 1 of a length 3 array), and the execution lines both before and after the Branch fire, but the Remove Item node just… doesn’t fire? The Print String at the end prints True, but printing the items in the array after the event finishes prints the original 3 items without the input Actor having been removed.

I know I’m prolly overlooking something extremely stuipid but I need a second set of eyes to give it a once-over and let me know what I’m missing…

1 Like

Nah, it’s just an UE thing.

image

This :point_up_2: is a copy of the struct. Try a function and:

When you select the Set Members node, you get to expose the data to be modified.

1 Like

So I have to pass a reference into a function for the Remove Item node to work?

Using your suggestion, I created a function like this:

But when I call it from an event, it still doesnt work

Do I need to wrap that event into a function as well? If so, at what point can I stop wrapping events into functions and call with an event?

Note that the struct parameter is set to “pass by reference” and shown with a diamond symbol as @Everynone has shown. You are still passing a copy when the symbol is round.

1 Like

What am I missing now? I selected the function node and checked pass-by-ref, but upon recompiling the node remains a circle.

EDIT: I found that to get the diamond I have to set the input to pass-by-ref, compile, delete the input, then add the input again. Dunno why but now I have the diamond at least…