# How can I make my C++ function target myCharacter in blueprints?

**URL:** <https://forums.unrealengine.com/t/how-can-i-make-my-c-function-target-mycharacter-in-blueprints/284268>\
**Category:** Blueprint\
**Tags:** unreal-engine, CPP, Blueprint, question\
**Created:** [May 26, 2014, 1:50pm UTC](https://forums.unrealengine.com/t/how-can-i-make-my-c-function-target-mycharacter-in-blueprints/284268 "2014-05-26T13:50:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![robbiecooper](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robbiecooper](https://forums.unrealengine.com/u/robbiecooper)\
**Post date:** [May 26, 2014, 1:50pm UTC](https://forums.unrealengine.com/t/how-can-i-make-my-c-function-target-mycharacter-in-blueprints/284268/1 "2014-05-26T13:50:08Z")

</div>

I’ve made a little function in the parent class of myCharacter, in C++. However, although myCharacter inherits from it, and the function is available in BP, it isn’t going to work;

 ![7076-screengrb3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/9/409f28e66755d1f1331dcb37c0c3a2dc0b188386.jpeg)

The function takes two arrays that are variables in the myCharacter blueprint, and returns a new array. However, I cant set the variables as the inputs to the function within the BP, probably because the target is the parent class, not myCharacter object itself. The myCharacter object is not visible in C++, as far as I can see. Any advice would be much appreciated! Cheers…

---

<div class="post-metadata">

**Author:** ![robbiecooper](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robbiecooper](https://forums.unrealengine.com/u/robbiecooper)\
**Post date:** [May 26, 2014, 2:13pm UTC](https://forums.unrealengine.com/t/how-can-i-make-my-c-function-target-mycharacter-in-blueprints/284268/2 "2014-05-26T14:13:08Z")

</div>

Hold up, this may be as simple as declaring the arrays as Uproperties in the C++

> **[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...

---

<div class="post-metadata">

**Author:** ![robbiecooper](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robbiecooper](https://forums.unrealengine.com/u/robbiecooper)\
**Post date:** [May 26, 2014, 3:04pm UTC](https://forums.unrealengine.com/t/how-can-i-make-my-c-function-target-mycharacter-in-blueprints/284268/3 "2014-05-26T15:04:44Z")

</div>

Is it possible to declare Uproperties as Ufunction arguments? Is that what I have to do here?

---

<div class="post-metadata">

**Author:** ![AnxGotta](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AnxGotta](https://forums.unrealengine.com/u/AnxGotta)\
**Post date:** [May 26, 2014, 4:47pm UTC](https://forums.unrealengine.com/t/how-can-i-make-my-c-function-target-mycharacter-in-blueprints/284268/4 "2014-05-26T16:47:32Z")

</div>

If I understand you correctly… you have a `ParentClass` to your `MyCharacter` class. This `ParentClass` has a Blueprint accessible function `DeleteHandHold` that that takes in two `TArray`s as parameters and then returns a `TArray`. When you put `DeleteHandHold` in the Blueprint of your `MyCharacter` class, it isn’t accepting the `TArray`s called `ReceiveHandHold` and `ActiveHandHold` as parameter inputs to the node.

What you could try is to make a wrapper function in your `MyCharacter` class.

```
UFUNCTION(BlueprintCallable)
TArray<YOUR_TYPE> DeleteHandHold_Wrapper(TArray<YOUR_TYPE> ReceiveHandHold, TArray<YOUR_TYPE> ActiveHandHold){
    return Super::DeleteHandHold(ReceiveHandHold, ActiveHandHold);
}

```

Then you would use that node in the `MyCharacter` Blueprint.

There might be something else odd happening with the `ParentClass` function but it’s hard to say without seeing your whole implementation. If this error is some Blueprint functionality error… I’m not sure. This wrapper method should work though.

Hopefully that works for you!

---

<div class="post-metadata">

**Author:** ![robbiecooper](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robbiecooper](https://forums.unrealengine.com/u/robbiecooper)\
**Post date:** [May 26, 2014, 5:00pm UTC](https://forums.unrealengine.com/t/how-can-i-make-my-c-function-target-mycharacter-in-blueprints/284268/5 "2014-05-26T17:00:02Z")

</div>

Hey AnXgotta

I just opened a different project which has a C++ header and cpp file for the character class, not just a parent class. It works as I was expecting it to do in the first place. The parameter arrays are on the other side of the node in blueprint, and they accept “get” vales for array variables in the blueprint. I’m going to try your method too, thanks for the reply…

---

<div class="post-metadata">

**Author:** ![AnxGotta](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AnxGotta](https://forums.unrealengine.com/u/AnxGotta)\
**Post date:** [May 26, 2014, 5:01pm UTC](https://forums.unrealengine.com/t/how-can-i-make-my-c-function-target-mycharacter-in-blueprints/284268/6 "2014-05-26T17:01:41Z")

</div>

Well, I’m glad you didn’t have to use this work around and you got it working properly! =)

---

<div class="post-metadata">

**Author:** ![robbiecooper](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robbiecooper](https://forums.unrealengine.com/u/robbiecooper)\
**Post date:** [May 27, 2014, 8:59pm UTC](https://forums.unrealengine.com/t/how-can-i-make-my-c-function-target-mycharacter-in-blueprints/284268/7 "2014-05-27T20:59:48Z")

</div>

Turns out this was caused by using pass-by-reference in the function parameters. In order to make blueprint variables pass by reference, see here;

> **[Is it possible to pass blueprint variables as references?](https://forums.unrealengine.com/questions/29680/is-it-possible-to-pass-blueprint-variables-as-refe.html)**
>
> I’ve been trying to figure out how to encapsulate some of the logic in my blueprints into reusable functions and macros. One speedbump I’ve ran into is that much of my duplicate code is somewhat stateful (requiring to set local variables). I could...

However, not sure that solves anything going in the other direction (making a C++ function for use in blueprints), my input variables were on the right hand side of the node in blueprint, and would only take getters, not setters.
