Then you can call SetTickableWhenPaused(true) for the particle component:
Then call this some where some time:
Then crash.
We’ve examined the call stack and suspecting it’s a bug. The TickTaskManager clears the TickFunction->TaskPointer first then calls ExecuteTick(), however when during ExecuteTick(), tick function uses TaskPointer so it crashes.
Code samples are below:
TickTaskManager.cpp // the calling site, call ExecuteTick() then goes to particle component.
for (TSet<FTickFunction*>::TIterator It(AllEnabledTickFunctions); It; ++It)
{
TickFunction = *It;
TickFunction->TaskPointer = nullptr; // this is stale, clear it out now
if (TickFunction->bTickEvenWhenPaused && TickFunction->TickState == FTickFunction::ETickState::Enabled)
{
TickFunction->TickVisitedGFrameCounter = GFrameCounter;
TickFunction->TickQueuedGFrameCounter = GFrameCounter;
TickFunction->ExecuteTick(InContext.DeltaSeconds, InContext.TickType, ENamedThreads::GameThread, FGraphEventRef());
ParticleComponent.cpp // crash is here, GetCompletionHandle() failes inside.
{
SCOPE_CYCLE_COUNTER(STAT_UParticleSystemComponent_QueueAsync);
AsyncWork = TGraphTask<FParticleAsyncTask>::CreateTask(nullptr, ENamedThreads::GameThread).ConstructAndDispatchWhenReady(this);
#if !WITH_EDITOR // we need to not complete until this is done because the game thread finalize task has not beed queued yet
ThisTickFunction->GetCompletionHandle()->DontCompleteUntil(AsyncWork);
#endif
}
When I added a ParticleSystemComponent (MyPSC) to my actor class and set MyPSC->SetTickableWhenPaused(true); I did not receive a crash when I tried to play in the editor. Can you provide the setup where you’re setting bTickableWhenPaused as well as the callstack and log files from the crash for additional information?
Ah, sorry that I didn’t mention you can’t test this in PIE, since PIE would lead to the non-async part of particle component’s Tick so it would never crash. As you can see the posted code snippets are specific to “#if !WITH_EDITOR”.
I took the sample project I had and tried to test it in a Standalone window as well as a packaged game and did not get a crash. Can you add the callstack and log files from the crash as well as the steps for your setup to help me test on my end?
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.
Add MyPSC = CreateDefaultSubobject < UParticleSystemComponent>(TEXT("MyPSC")); and MyPSC->SetTickableWhenPaused(true); to the constructor
After compiling the code, in the editor you add a particle system to the component in blueprints and place an instance in the level
Package and run the packaged game
From my understanding, it is here that you are getting a crash? If this is accurate, can you let me know if you get a crash in a new sample project while running the packaged game on Windows. If so, please add the sample project to help identify the issue. If you do not crash with these steps on Windows, can you confirm if you do get a crash on PS4? If you are doing something different or I’ve missed something in my steps, please let me know exactly what your setup looks like and exactly what you are doing that leads to the crash.
The only difference of my setup is that I made my whole actor in Blueprint, otherwise I think mine is the same as yours. And after reading my own post again, I found that I made a critical mistake. You have to pause the game to trigger the crash, I don’t know why I missed describing this in my post…I’m truly sorry for that! I’ll edit the post title and content.
So the steps are, make this actor with particle component, run the packaged game, then pause the game (you can make a keyboard event to execute “SetGamePaused(true)”, of course) and wait the assertion comes up.
I was able to reproduce the crash after pausing the game and have entered the bug UE-34486 for further investigation. You can view the public tracker for this issue here: Unreal Engine Issues and Bug Tracker (UE-34486)