UKismetArrayLibrary::Array_Find
#include "Kismet/KismetArrayLibrary.h"
Access: public
Specifiers: staticBlueprintPureCustomThunk
Description
Returns the index of the first instance of a value in an array, or -1 if it isn't found.
Caveats & Gotchas
- • Returns -1 on failure, not INDEX_NONE explicitly in Blueprint output — treat any negative result as 'not found' before using it to index the array.
- • Displayed in Blueprint as 'Find Item' with CompactNodeTitle 'FIND'.
- • Marked BlueprintThreadSafe. Only finds the first match — use Array_RemoveItem or a manual loop if you need every matching index.
Signature
static int32 Array_Find(const TArray<int32>& TargetArray, const int32& ItemToFind); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TargetArray | const TArray<int32>& | The array to search. | — |
| ItemToFind | const int32& | The value to search for. | — |
Return Type
int32 Example
Find an element's index C++
TArray<int32> Values = { 10, 20, 30 };
const int32 FoundIndex = UKismetArrayLibrary::Array_Find(Values, 20);
// FoundIndex == 1 See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?