# How to dynamically change function parameter type?

**URL:** <https://forums.unrealengine.com/t/how-to-dynamically-change-function-parameter-type/443529>\
**Category:** Plugins\
**Tags:** Input, gameplay-tags, type, unreal-engine, Plugins, question, CPP\
**Created:** [February 16, 2019, 5:49pm UTC](https://forums.unrealengine.com/t/how-to-dynamically-change-function-parameter-type/443529 "2019-02-16T17:49:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vlady\_Veselinov](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vlady_veselinov/32/621446_2.png) [@Vlady\_Veselinov](https://forums.unrealengine.com/u/Vlady_Veselinov)\
**Post date:** [February 16, 2019, 5:49pm UTC](https://forums.unrealengine.com/t/how-to-dynamically-change-function-parameter-type/443529/1 "2019-02-16T17:49:25Z")

</div>

I’m making a GameplayEvents plugin that has a better dev experience than UE’s native events, using GameplayTags.  
Is there a way to change the type of a function parameter based on the value of another parameter like in this concept?

![268762-2019-02-16-17-01-07.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/6/0/3606cc5662ccd78e9d3555d35e814da7245d1e0d.png)

---

<div class="post-metadata">

**Author:** ![Mohit\_Agrawal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mohit\_Agrawal](https://forums.unrealengine.com/u/Mohit_Agrawal)\
**Post date:** [February 18, 2019, 2:03pm UTC](https://forums.unrealengine.com/t/how-to-dynamically-change-function-parameter-type/443529/2 "2019-02-18T14:03:45Z")

</div>

I think what you are looking for is a concept called function overloading where we write two same functions with different parameters and the appropriate ones gets called according to the passed parameter

E.g  
void func(){}  
void func(int x){}

Then if we write  
func(); the first method is called

func(1); then the second method is called

---

<div class="post-metadata">

**Author:** ![Vlady\_Veselinov](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vlady_veselinov/32/621446_2.png) [@Vlady\_Veselinov](https://forums.unrealengine.com/u/Vlady_Veselinov)\
**Post date:** [February 18, 2019, 2:25pm UTC](https://forums.unrealengine.com/t/how-to-dynamically-change-function-parameter-type/443529/3 "2019-02-18T14:25:18Z")

</div>

This is a plugin, so there’s no way for me to know what the user-defined types will be. What I want to do here is like “generative” overloading. For example, the user can define a gameplay tag “event.damage” and can specify a Struct to go with that event. I want this Publish function to set the type of the Payload parameter based on the value of the Gameplay Tag parameter.
