I want to find class with one type on array and log them or something.
Help please
I want to find class with one type on array and log them or something.
Help please
We’re gonna need a lot more information to be able to help.
What are you looking for, what do you have? Is this an array of multiple objects and you need to identify each object’s type? Are you sorting multiple arrays and trying to discover which type each holds?
Please provide more details, and example code helps too!
Its UItem array. I want to search for UMagItem.
Do you need to find an item in the array by its type? If that’s so there are multiple ways to achieve this:
1)
UMagItem* MagItem = Array.FindByPredicate([obj](UItem*& Item)
{
return Item->IsA(UMagItem::StaticClass());
});
UMagItem* FoundItem = nullptr;
for(auto Item : Array)
{
if(Item->IsA(UMagItem::StaticClass()))
{
FoundItem = MItem;
break;
}
}
if(FoundItem)
{
// do something
}
Thanks, how to get Index of UMagItem?
Thanks, how can I see index of this item?