artest113
(artest113)
September 30, 2023, 7:16pm
1
Hello everyone,
As per title, how do I merge 2 different objects of array into one, and then sort or make a new array out of it with sorted attribute? It goes like this:
ArrayA:
Display Name: Amy , Score: 40
Display Name: James, Score: 50
ArrayB:
Display Name: Alex, Score: 60
Display Name: Lex, Score: 70
Expected New Array
ArrayC:
Display Name: Amy , Score: 40
Display Name: James, Score: 50
Display Name: Alex, Score: 60
Display Name: Lex, Score: 70
ArrayA and ArrayB objects are made up of different character class.
1 Like
pezzott1
(pezzott1)
October 1, 2023, 5:46am
4
Without an idea of your knowledge of blueprint, guess a generic way could be:
One of the characters or a third class is needed to have a reference to all actors with the data to merge.
Iterate the references to append each to a new array or an existing one.
swap the indexes using your favorite sorting algorithm .
And of course do all this inside a function.
If a third class is used there is also the option to get the array using an interface to avoid the include of the character class.
Here are some useful links:
Hope it helps. Let me know if you need anything specific.
1 Like
artest113
(artest113)
October 1, 2023, 2:25pm
5
thanks for the tips! will setup a third class and see how it goes, thanks for sharing the documentation too, it’s very useful.