TArrayMyArray; MyArray.Add(1); MyArray.Add(2); MyArray.Add(3); int NewValue = 4; MyArray.Append(&NewValue, 1); // add NewValue to the end of MyArray // MyArray now contains {1, 2, 3, 4}
TArrayIn this example, we have two TArrays of integers: ArrayOne and ArrayTwo. We add the values 1, 2, and 3 to ArrayOne using the Add function, and add the values 4 and 5 to ArrayTwo. We then use the Append function to add all of the elements in ArrayTwo to the end of ArrayOne. Overall, TArray Append is a useful function for adding elements to arrays in the Unreal Engine's C++ programming environment.ArrayOne; ArrayOne.Add(1); ArrayOne.Add(2); ArrayOne.Add(3); TArray ArrayTwo; ArrayTwo.Add(4); ArrayTwo.Add(5); ArrayOne.Append(ArrayTwo); // add ArrayTwo to the end of ArrayOne // ArrayOne now contains {1, 2, 3, 4, 5}