# How to pass a function as parameter of UFUNCTION() function?

**URL:** <https://forums.unrealengine.com/t/how-to-pass-a-function-as-parameter-of-ufunction-function/417332>\
**Category:** C++\
**Tags:** unreal-engine, functions, CPP, question\
**Created:** [February 14, 2018, 5:37pm UTC](https://forums.unrealengine.com/t/how-to-pass-a-function-as-parameter-of-ufunction-function/417332 "2018-02-14T17:37:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Balgy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Balgy](https://forums.unrealengine.com/u/Balgy)\
**Post date:** [February 14, 2018, 7:32pm UTC](https://forums.unrealengine.com/t/how-to-pass-a-function-as-parameter-of-ufunction-function/417332/2 "2018-02-14T19:32:32Z")

</div>

TFunction is what you need. Anything else is just more work and unneeded complication for me.

Declare a function then add TFunction as a parameter.

```
void MyFunction( TFunction<void(int32 Numparam)> MyFunctionToCall)

```

TFunction works like std::function in normal C++ therefore, “void” is the function’s return type and anything inside the ( ) is the parameters, which can be left empty.

TFunction can’t be a parameter in a UFUNCTION() so keep that in mind.

A simpler way to use function pointers is with a typedef. There is a great tutorial which I link below:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-pass-a-function-as-parameter-of-ufunction-function/417332)._
