# Set Particle Component's TickEvenWhenPaused to true, then run the game, then SetGamePaused to true, then crash

**URL:** <https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682>\
**Category:** FX\
**Tags:** crashes, pause-game, unreal-engine, question\
**Created:** [July 21, 2016, 12:37pm UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682 "2016-07-21T12:37:14Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [July 21, 2016, 12:37pm UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/1 "2016-07-21T12:37:14Z")

</div>

The actor’s setup is like this:

![102271-particle_crash.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/3/d/13de4a879d7d5554cb98ea8c222cb1a43b1e0dca.png)

Then you can call SetTickableWhenPaused(true) for the particle component:

![102273-particle_crash_2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/c/4/ec467e83b409fefef545f8dc9f68487e16fb118c.png)

Then call this some where some time:

![102274-particle_crash_3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/2/d/62d3b7af6f643597e23dbc408d7e91a91cea687d.png)

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
}
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [July 21, 2016, 5:31pm UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/2 "2016-07-21T17:31:30Z")

</div>

Hey -

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?

---

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [July 22, 2016, 8:32am UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/3 "2016-07-22T08:32:27Z")

</div>

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”.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [July 22, 2016, 2:10pm UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/4 "2016-07-22T14:10:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [July 27, 2016, 1:52pm UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/5 "2016-07-27T13:52:08Z")

</div>

Hey -

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.

Cheers

---

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [July 28, 2016, 10:17am UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/6 "2016-07-28T10:17:04Z")

</div>

Ok, the call stack is below

```
Assertion failed: TaskPointer [File:C:\dev\VR\Game\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp] [Line: 1702]
[Callstack] 0x02c5ba67 - UParticleSystemComponent::TickComponent(float, ELevelTick, FActorComponentTickFunction*)
[Callstack] 0x026a812a - FActorComponentTickFunction::ExecuteTick(float, ELevelTick, ENamedThreads::Type, TRefCountPtr<FGraphEvent> const&)
[Callstack] 0x031d6495 - FTickTaskLevel::RunPauseFrame(FTickContext const&)
[Callstack] 0x031cfd5c - FTickTaskManager::RunPauseFrame(UWorld*, float, ELevelTick)
[Callstack] 0x02ab772f - UWorld::Tick(ELevelTick, float)
[Callstack] 0x028ef36a - UGameEngine::Tick(float, bool)
[Callstack] 0x00418827 - FEngineLoop::Tick()
[Callstack] 0x0042aba4 - tchar_main(int, wchar_t**)
[Callstack] 0x0042a431 - main
[Callstack] 0x03bdc82b - _start
```

---

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [July 28, 2016, 10:19am UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/7 "2016-07-28T10:19:58Z")

</div>

The setup is fairly simple, like this:

![102271-particle_crash.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/3/d/13de4a879d7d5554cb98ea8c222cb1a43b1e0dca.png)

---

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [July 28, 2016, 10:23am UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/8 "2016-07-28T10:23:34Z")

</div>

And actually we’re having this issue in packaged game, but I’m not sure if this problem is only for PS4.

---

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [July 28, 2016, 10:25am UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/9 "2016-07-28T10:25:17Z")

</div>

Hi, please check the comment above, thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [July 29, 2016, 4:11pm UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/10 "2016-07-29T16:11:32Z")

</div>

Just to recap to confirm if my setup is correct, please let me know if you are doing the following (or what you are doing differently)

- Create new class based on Actor
- Add `UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = Test) UParticleSystemComponent* MyPSC;` to header
- 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.

---

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [August 10, 2016, 8:53am UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/11 "2016-08-10T08:53:14Z")

</div>

Hi :

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.

---

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [August 10, 2016, 9:08am UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/12 "2016-08-10T09:08:12Z")

</div>

Hi, please check the new comment and edited post, thanks T.T

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [August 10, 2016, 2:34pm UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/13 "2016-08-10T14:34:31Z")

</div>

Hey -

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)](https://issues.unrealengine.com/issue/UE-34486)

Cheers

---

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [August 11, 2016, 3:29am UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/14 "2016-08-11T03:29:37Z")

</div>

Great, thanks!

---

<div class="post-metadata">

**Author:** ![MArgudo\_Panache](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MArgudo\_Panache](https://forums.unrealengine.com/u/MArgudo_Panache)\
**Post date:** [September 29, 2016, 8:21pm UTC](https://forums.unrealengine.com/t/set-particle-components-tickevenwhenpaused-to-true-then-run-the-game-then-setgamepaused-to-true-then-crash/364682/15 "2016-09-29T20:21:41Z")

</div>

This issue is blocking me. Once you find a fix, could you please post it here so I can modify the code without waiting for 4.14 ?  
Thanks
