RealDocs

UKismetArrayLibrary::Array_Resize

function Engine Blueprint Since unknown
#include "Kismet/KismetArrayLibrary.h"
Access: public Specifiers: staticBlueprintCallableCustomThunk

Description

Resizes an array to the given size, truncating extra elements or appending default-constructed ones as needed.

Caveats & Gotchas

  • Growing the array fills new slots with the element type's default value (0, empty string, nullptr, etc.), not copies of the last element.
  • Shrinking discards elements past the new size permanently — there is no undo.
  • A negative Size is treated as invalid and logs a warning rather than clearing the array.

Signature

static void Array_Resize(UPARAM(ref) TArray<int32>& TargetArray, int32 Size);

Parameters

Name Type Description Default
TargetArray UPARAM(ref) TArray<int32>& The array to resize. Passed by reference and mutated in place.
Size int32 The new size of the array.

Return Type

void

Example

Grow an array to a fixed length C++
TArray<int32> Values = { 1, 2 };
UKismetArrayLibrary::Array_Resize(Values, 5);
// Values is now { 1, 2, 0, 0, 0 }

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.