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

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;

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…

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

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

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 TArrays as parameters and then returns a TArray. When you put DeleteHandHold in the Blueprint of your MyCharacter class, it isn’t accepting the TArrays 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!

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…

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

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;

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.