I can’t believe this is happening. First I had trouble last night because I inadvertently put a semicolon where it didn’t belong, so today I thought it was fixed but I’m still having horrible issues and can’t for the life of me see what I’m doing wrong:
// Find all the overlapping actors
TArray<AActor*> OverlappingActors;
PressurePlate->GetOverlappingActors(OUT OverlappingActors);
// Iterate through them adding their masses
for (const auto* Actor : OverlappingActors)
{
TotalMass += Actor->FindComponentByClass<UPrimitiveComponent>()->GetMass;
UE_LOG(LogTemp, Warning, TEXT("%s on pressure plate"), *Actor->GetName())
}
return TotalMass;
}
This has returned these 2 errors:
Error C3867 ‘UPrimitiveComponent::GetMass’: non-standard syntax; use ‘&’ to create a pointer to member
Error C2297 ‘+=’: illegal, right operand has type ‘float (__cdecl UPrimitiveComponent::* )(void) const’
I’m sure it has something to do with the fact that I’m using Visual Studio 2019 and Unreal Editor 4.22.3 while Ben is using the older versions in this video (Iterating over TArray with for) but I’m just completely lost at this point. Everything has been going perfectly fine until now. Does anybody have any idea what I can do about this? I can’t get a successful build in VS and my compile fails in UE. Thanks in advance for any help