Why would this function crash my project? could it be something in settings or this function?

// gets total KG of things on plate
float UDoorOpenClose::GetTotalMassOfActorOnPlate()
{
float TotalMass = 0.0f;

// finds all overlapping actors
TArray<AActor*> OverlappingActors;
TriggerVolume->GetOverlappingActors(OUT OverlappingActors);

// Iterate through them add their mass
for (const auto* Actor : OverlappingActors)
{
	TotalMass += Actor->FindComponentByClass<UPrimitiveComponent>()->GetMass();
	UE_LOG(LogTemp, Warning, TEXT("on pressure plate"));
}

return TotalMass;
}

when you use const auto* Actor

auto gets AAcotr* which is dereferenced because of auto* and then -> operator becomes ambiguous

see this for reference

I figured it out ATriggervolume was not set to editanywhere.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms