WildCard Array in UFunction / C++ Macros

Hey guys,

I’m wanting to make functions to speed up workflow of the projects that our team works in. So far, a lot of this functionality (which is already functional) has been made inside Blueprint Function and Macros Libraries made inside the Engine.

However, some of the functionality that we want to create is not best done inside Blueprints. Furthermore, the Workflow Recommended Limitations of the Blueprint Environment make it more encouraging to make this functionality within c++,

I’m still somewhat new to UE4 C++ and am still familiarizing with it (coming from std C++).

My understanding is that Functions don’t take Wildcard Variable Types (or at least not in the Blueprint world) and that such environment is created inside a Macros World. From this understanding, 2 questions arise:

  • is it possible to get a good workflow utilizing WildCard Items and Arrays inside UFunctions? How?
  • If Macros is the way, how does one approach the creation of Macro Libraries inside C++?

Two examples of functionalities desired to make:

Thank you!

First of there no such thing as UE4 C++, it still normal C++ and UE4 simply wraps all the standard library functions… which you can still use btw (but it’s not recommanded). UFUNCTION macros are just dummy macros which UnrealHeaderTool parse to generate extra C++ code which adds things to reflection system automaticly bind it to blueprint. Blueprint on other hand is just graph data which gets compiled to VM code and then based on that VM does C++ function calls. So answering 2nd question, no you can not do blueprint macros in C++ or else you manipulate UBlueprint asset because it’s just blueprint graph data feature, and there features that does not translate to C++ aspecially custom nodes coded in UK2Nodes because C++ can’t support those… because it’s still normal C++

Lucky for you the wildcard array is someone what supported via just UFUNCTION specifiers and for that go look up to ArrayKismetLibrary where those nodes are declared:

https://github.com/EpicGames/UnrealEngine/blob/f509bb2d6c62806882d9a10476f3654cf1ee0634/Engine/Source/Runtime/Engine/Classes/Kismet/KismetArrayLibrary.h
https://github.com/EpicGames/UnrealEngine/blob/08ee319f80ef47dbf0988e14b546b65214838ec4/Engine/Source/Runtime/Engine/Private/KismetArrayLibrary.cpp

So look up those

By UE4 c++ I meant the notation and wrapping.

I understand (UFunction Macros).

For the second question, If I needed a branching node, such as a modified sequence (for example), is there a way to do it within the creation of custom classes (and thus avoiding the modification of engine source code)?

Thank you on the links by the way! Very useful information. :slight_smile:

Also, for the 2 ifs macro, that could easily just be a function, since it doesn’t require any wildcard types.

No for the IF Function I’m mostly asking how do you add (And then access) the Declaration of the Execution Nodes.

Ah yeah I see that now

Do you have knowledge of how that is done?

If I’m understanding you correctly then I believe you should be able to do that using the ExpandEnumAsExecs meta specifier in the UFUNCTION macro. Essentially you define a new enum and then you can use each enumerator therein as an out/in exec pin.

Check out this link for an example of it in practice to see if it’ll help.

That’s awesome!

No I don’t. I’m not sure you can. I think unless it’s an easy solution it would end up creating more headache than it’s worth.