When getting the actors in the trigger and adding up their Mass…
It compiles and runs correctly.
It still red underlines “OverlappingActors” in the range ‘for’ and gives this error.
this range-based ‘for’ statement requires a suitable “begin” function and none was found
It still red underlines “UPrimitiveComponent” for finding the component and gives this error.
type name not allowed
I tried lots of searching and Google didn’t even recognize the error.
I tried restarting.
float UOpenDoor::GetPressurePlateSum()
{
float PressurePlateSum = 0.0f;
//get the list of all actors triggering the plate
TArray<AActor*> OverlappingActors;
PressurePlate->GetOverlappingActors(OverlappingActors);
for (const auto* Actor : OverlappingActors)
{
PressurePlateSum += Actor->FindComponentByClass<UPrimitiveComponent>()->GetMass();
//UE_LOG(LogTemp, Warning, TEXT("Object weighed: %s"), *(Actor->GetName()))
}
return PressurePlateSum;
}