The unreal 4 doc for spawning an actor is not working in unreal 5 and the documentation for UNreal 5 is not updated. Any solutions ?
2 solutions I can think of, one is look for a tutorial on Youtube or some blog, the second solution is open one of the templates like the first person template and it should have an example of spawning a projectile.
In your header add this, you can change AActor with a specific class, in your derived BP class indicate the class you want to use for spawning.
UPROPERTY(EditDefaultsOnly, Category=Projectile)
TSubclassOf<class AActor> ActorToSpawn;
In your C++
if(ActorToSpawn)
{
FActorSpawnParameters ActorSpawnParams;
ActorSpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding;
FVector SpawnLocation; //indicate valid location
FRotator SpawnRotation(0.f);
AActor* SpawnedActor = GetWorld()->SpawnActor<AActor>(ActorToSpawn, SpawnLocation, SpawnRotation, ActorSpawnParams);
}
1 Like
you were right . there is also a good video tutorials serie on youtube : Procedural Generation
1 Like