# \[C++\] How do i spawn a particle in a static function?

**URL:** <https://forums.unrealengine.com/t/c-how-do-i-spawn-a-particle-in-a-static-function/351235>\
**Category:** FX\
**Tags:** unreal-engine, static, functions, UE4, question, CPP\
**Created:** [March 21, 2016, 1:04pm UTC](https://forums.unrealengine.com/t/c-how-do-i-spawn-a-particle-in-a-static-function/351235 "2016-03-21T13:04:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gunschlinger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gunschlinger](https://forums.unrealengine.com/u/Gunschlinger)\
**Post date:** [March 21, 2016, 1:04pm UTC](https://forums.unrealengine.com/t/c-how-do-i-spawn-a-particle-in-a-static-function/351235/1 "2016-03-21T13:04:18Z")

</div>

Hi. I created a static function in a empty class for a impact event. Wich gets called when you hit something in the game. So Physics specific effects can spawn. This function is static. How do i spawn the particle in the static function. I cant use a reference since its static.

---

<div class="post-metadata">

**Author:** ![DennyR](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DennyR](https://forums.unrealengine.com/u/DennyR)\
**Post date:** [December 8, 2016, 3:45pm UTC](https://forums.unrealengine.com/t/c-how-do-i-spawn-a-particle-in-a-static-function/351235/2 "2016-12-08T15:45:33Z")

</div>

[GetWorldFromContextObject](https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Engine/UEngine/GetWorldFromContextObject/index.html). Simply pass any Actor or UObject that lives in the world and you have a reference to the world to spawn stuff.

Alternatively you could use UGameplayStatics and call those functions from your static function.
