UKismetArrayLibrary::Array_Add
#include "Kismet/KismetArrayLibrary.h"
Access: public
Specifiers: staticBlueprintCallableCustomThunk
Description
Appends an item to the end of an array and returns the index of the newly added element.
Caveats & Gotchas
- • TargetArray is declared as TArray<int32> only as a wildcard placeholder — CustomThunk resolves the real element type (via GenericArray_Add) at the call site, so this works for any Blueprint array type.
- • In C++, calling TArray::Add() directly is simpler and avoids the reflection overhead this thunk incurs — this function exists to back the Blueprint 'Add' node, not for native array manipulation.
- • Displayed in Blueprint with CompactNodeTitle 'ADD' and DisplayName 'Add', not the C++ name Array_Add.
Signature
static int32 Array_Add(UPARAM(ref) TArray<int32>& TargetArray, const int32& NewItem); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TargetArray | UPARAM(ref) TArray<int32>& | The array to add the item to. Passed by reference and mutated in place. | — |
| NewItem | const int32& | The item to append to the array. | — |
Return Type
int32 Example
Add an item and capture its index C++
TArray<int32> Values = {1, 2, 3};
int32 NewIndex = UKismetArrayLibrary::Array_Add(Values, 4); // Values = {1,2,3,4}, NewIndex = 3 Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?