Class rvalue used as lvalue?

Getting:

 error C4238: nonstandard extension used : class rvalue used as lvalue

for

ACoinSound* SpawnedActor1 = (ACoinSound*)GetWorld()->SpawnActor(ASound, &AActor::GetActorLocation());

Change the line to:

ACoinSound* SpawnedActor1 = GetWorld( )->SpawnActor<ACoinSound>( GetActorLocation( ) );

The issue is actually the &AActor::GetActorLocation. But I also wanted to let you know that SpawnActor is templated so you dont have to cast the way you are. Also you don’t need to define the class, but if you wanted to, it would be ASound::StaticClass( ) (To obtain the UClass* variable)

ah sorry, If you want to spawn at a specific location then you will need to provide a rotation, since the function definition is:

T* SpawnActor( UClass* Class, FVector const& Location, FRotator const& Rotation, const FActorSpawnParameters& SpawnParameters = FActorSpawnParameters() )

So just change to:

SpawnActor<ACoinSound>( GetActorLocation( ), FRotator( 0,0,0 ) );

Thanks for the reply :), however your answer didn’t work, i get an error with the member selector operator ( → ).

error C2664: 'T *UWorld::SpawnActor<ACoinSound>(UClass *,const FActorSpawnParameters &)' : cannot convert argument 1 from 'FVector' to 'const FActorSpawnParameters &'

Yep that fixed it, many thanks