The error you are getting is normal. If I understand, you want to iterate all objects that are overlapping with this
(the object you are writing the code in), so the second block of your code is almost correct. You can try this one:
TArray<AActor*> Result;
GetOverlappingActors(Result, AWallItem::StaticClass());
// Result is an array of AActor not AWallItem, that is why you need the cast
// You could use the UInterface architecture
// if you do not want for some reason the cast (this is another topic)
for (AActor* wallItemActor : Result)
{
// You must cast the wallItemActor cause its an AActor. Not AWallItem.
AWallItem* wallItem = Cast<AWallItem>(wallItemActor);
// Check if is nullptr. SAFETY FIRST :-)
if(wallItem != nullptr)
{
// Call your function etc.
wallItem->Interact();
...
}
}
Hope the comments help…