# Passing generic Structure Object to C++ Function

**URL:** <https://forums.unrealengine.com/t/passing-generic-structure-object-to-c-function/445702>\
**Category:** Blueprint\
**Tags:** Structure, function-library, unreal-engine, question, Blueprint, CPP\
**Created:** [March 21, 2019, 10:36am UTC](https://forums.unrealengine.com/t/passing-generic-structure-object-to-c-function/445702 "2019-03-21T10:36:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RelaX92](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RelaX92](https://forums.unrealengine.com/u/RelaX92)\
**Post date:** [March 21, 2019, 10:36am UTC](https://forums.unrealengine.com/t/passing-generic-structure-object-to-c-function/445702/1 "2019-03-21T10:36:03Z")

</div>

Hi,

I’m trying to implement a function in C++ to which I can pass an object of any structure as a parameter.

Unfortunately this fails because of the type of the passing parameter.

Here is an example of what I would like to accomplish with an user defined structure:

 ![271941-dosomehting.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/4/3/0438d3ef82564cbb7997a7f57c58062523a60fa3.png)

![271942-poststructure.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/d/8ada70d0e7de29f5bad70a86a9203bb08688aa9d.png)

It seems like the type needs to be FStructOnScope, so, my function would need to look like

```
static FString DoSomethingWithStructInstance(const FStructOnScope* StructData);

```

But FStructOnScope isn’t supported, is that the wrong type or is there a way to accomplish what I want?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![Nebula\_Games\_Inc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nebula\_Games\_Inc](https://forums.unrealengine.com/u/Nebula_Games_Inc)\
**Post date:** [March 21, 2019, 3:15pm UTC](https://forums.unrealengine.com/t/passing-generic-structure-object-to-c-function/445702/2 "2019-03-21T15:15:28Z")

</div>

Would be interesting to know how to do this. I have tried to figure this out but never did. The best advice I got was looking into the “wildcard” slots for things like the “For Each Loop” macros and other nodes that take in wildcard data and see how UE4 source handles it.

---

<div class="post-metadata">

**Author:** ![RelaX92](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RelaX92](https://forums.unrealengine.com/u/RelaX92)\
**Post date:** [March 21, 2019, 5:25pm UTC](https://forums.unrealengine.com/t/passing-generic-structure-object-to-c-function/445702/3 "2019-03-21T17:25:41Z")

</div>

Got it working with some variation of [[Tutorial] How to accept wildcard structs in your UFUNCTIONs - Community Content, Tools and Tutorials - Unreal Engine Forums](https://forums.unrealengine.com/community/community-content-tools-and-tutorials/27351-tutorial-how-to-accept-wildcard-structs-in-your-ufunctions?56537-Tutorial-How-to-accept-wildcard-structs-in-your-UFUNCTIONs=)

It’s not nice, but atleast it works.

---

<div class="post-metadata">

**Author:** ![RelaX92](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RelaX92](https://forums.unrealengine.com/u/RelaX92)\
**Post date:** [March 21, 2019, 5:27pm UTC](https://forums.unrealengine.com/t/passing-generic-structure-object-to-c-function/445702/4 "2019-03-21T17:27:14Z")

</div>

Found a forum post with an explanation, thanks to the wildcard keyword.

I hoped for a cleaner solution, but it seems solid to me.

[https://forums.unrealengine.com/community/community-content-tools-and-tutorials/27351-tutorial-how-to-accept-wildcard-structs-in-your-ufunctions?56537-Tutorial-How-to-accept-wildcard-structs-in-your-UFUNCTIONs=](https://forums.unrealengine.com/community/community-content-tools-and-tutorials/27351-tutorial-how-to-accept-wildcard-structs-in-your-ufunctions?56537-Tutorial-How-to-accept-wildcard-structs-in-your-UFUNCTIONs=)

---

<div class="post-metadata">

**Author:** ![Nebula\_Games\_Inc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nebula\_Games\_Inc](https://forums.unrealengine.com/u/Nebula_Games_Inc)\
**Post date:** [March 21, 2019, 5:30pm UTC](https://forums.unrealengine.com/t/passing-generic-structure-object-to-c-function/445702/5 "2019-03-21T17:30:50Z")

</div>

Haha, glad I could point you in the right direction 🙂

---

<div class="post-metadata">

**Author:** ![ramory-l1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ramory-l1](https://forums.unrealengine.com/u/ramory-l1)\
**Post date:** [April 8, 2023, 8:11pm UTC](https://forums.unrealengine.com/t/passing-generic-structure-object-to-c-function/445702/6 "2023-04-08T20:11:49Z")

</div>

Doesn’t work for UE 5 ☹  
Any new solutions?
