I got a critical error when starting my level with “launch” instead of “play”. I nailed it down to my particle system, but I do not understand why it fails when starting by “launch” the level over the unreal editor. My AWorldControlActor, which spawn and posseses my UParticleSystemComponent lives forever and therefore not garbage collector should kill it, here the code:
FStringAssetReference rain_path(TEXT("/Game/Assets/Rain_P2000")); rain2000 = Cast<UParticleSystem>(rain_path.TryLoad()); // in Header: UParticleSystem* rain2000 rain_component = nullptr; // in Header: UParticleSystemComponent* rain_component; rain_component = UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), rain2000, this->GetActorLocation() - FVector(1000, 1000, this->GetActorLocation().Z - 100)); // This line gives a NULLPTR back, if started with launch, otherwise it works by play
“SpawnEmitterAtLocation” returns “Nullptr” if I use “Launch” and no particle system animation is started, otherwise with “play” a working pointer to UParticleSystemComponent is returned and the animation runs.
Hoping for help, ideas and advies. Using UE4.15.3.