Download

Find index of item in array need help.

While I worked in unity engine they had a piece of code that looked like this:

public class Item {

public string itemName, itemID, itemDescription;

}

public List<Item> items = new List<Item>();

int itemFoundIndex = items.FindIndex(i => i.itemName == “whatever”);

if(itemFoundIndex != -1){

//Do something;

}

The point of this code is to find the index of an item in a list / array not by searching for an identical item, but with a specific value.

Does unreal have any blueprint components that work like this?

Thanks in advanced.

have you tried the find item node? you give it a array and a item and it returns the index that item is located at.

Not by default, but Rama’s Victory Plugin has a feature for this if I’m not mistaken!