Using the new 'version' of SpawnActorDeferred

Old version ( deprecated error ) :

APCExplosionEffect* EffectActor = GetWorld()->SpawnActorDeferred<APCExplosionEffect>(ExplosionTemplate, NudgedImpactLocation, SpawnRotation);

New Version

	APCExplosionEffect* EffectActor = GetWorld()->SpawnActorDeferred<APCExplosionEffect>(ExplosionTemplate, FTransform(SpawnRotation, NudgedImpactLocation), ESpawnActorCollisionHandlingMethod::AlwaysSpawn);

with this, I’m getting a different error ,

error C2664: ‘T *UWorld::SpawnActorDeferred(UClass *,const FTransform &,AActor *,APawn *,ESpawnActorCollisionHandlingMethod)’ : cannot convert argument 2 from ‘FTransform’ to ‘const FVector &’

Why is it trying to convert my FTransform to Fvector , shouldin’t it accept Ftransfrom as shown in the API?

template< class T >
T* SpawnActorDeferred(
UClass* Class,
FTransform const& Transform,
AActor* Owner = nullptr,
APawn* Instigator = nullptr,
ESpawnActorCollisionHandlingMethod CollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined
)

If should be:

APCExplosionEffect* EffectActor = GetWorld()->SpawnActorDeferred<APCExplosionEffect>(ExplosionTemplate, FTransform(SpawnRotation, NudgedImpactLocation), nullptr, nullptr,ESpawnActorCollisionHandlingMethod::AlwaysSpawn);

WOW i think it worked.

Thanks a lot. if you don’t mind me asking , can you explain the solution to me?

DId the compiler recognize the different function because of the null pointer? Without it , it defaults to the old version?

This was awhile ago but just in case you were still wondering lol. You can’t skip parameters in a list in c++ even if they have default values, so if there are 3 default value parameters in a function, you have to define the first two to get to the third, otherwise you’re giving a different function definition. No more (X,Y,Z) from old UnrealScript. :frowning: