Check if the is same actor is in different arrays?

I’m trying to compare 2 different arrays, I have to check every element of array 1 against every element in array 2. is there a way to check if there is the same actor in each array?

What exactly are you trying to do? There may be a simpler method. But to answer your question directly, you can try using the nodes “find” and “contains” on the array to determine what actors are in there if you know what you are looking for.

Thanks Nebula Games!
I’m building an experience where the player will drag a colored bar over a 4 by 4 grid of random numbers, when a row is selected you will drag another colored bar to a column, once both row and column are chosen the number that is being overlapped by both colored bars is selected and the other numbers in the row and column are destroyed.

Here are screen shots of my blueprints, I start with a random number generation that is used to spawn a actor bp of corresponding static mesh. then I use those static mesh actors with a target point to populate the grid, when the player touches and releases the colored bar it will overlap the numbers in the row they selected, the same will happen with the next colored bar but with the columns. Once both bars are placed overlaps will be checked, the actor with both bars overlapping it will be selected and all other numbers in selected row and column will be destroyed. I kind of got it working, I can now delete the actor that is being overlapped but not sure how to destroy the other actors. Also, Let me know if there might be a simpler method or better way to do this.

Based on the screenshot you shared above, you shouldn’t have to compare each element of the arrays against each other. If you know the row and column numbers of the two color bars (for eg: row=3 & column=3 in the above scenario), you can use these values to pinpoint the overlapping item.

In the example scenario, since the 3rd column has a colored bar, then that means that the third element in the row array will be overlapping with it. So delete all numbers in that row except the 3rd one (default index = 2).

In a similar manner, delete all numbers in the column array except the element associated with colored row number i.e. 3rd row (index 2).

That makes sense I just don’t know who to set that up in Unreal. How would you set that up in blueprints? Do you know of a good example? I’ve been looking for one but haven’t been able to find one.

You can use this workflow:

Basically, you loop through the elements in the row and delete all items not corresponding to the selected column number. Then do a similar operation with the column as well.