How to change an input type (parameter - variable) based on another one? (Wildcards)

I’ve been here for several hours trying to figure out something “basic”.

What I’m trying to do:
A function (C++ code to Blueprint) with two variables (parameters) of the “wildcard” type, however, when connecting something to the input of the first variable, I would like the second variable to change to the same “input type”.

Current results:
When connecting something like “Integer” to the first variable, the second remains as Wildcard.

What I already know and what I tried (Super Summarized):
“DECLARE_FUNCTION”, meta = CustomThunk, CustomStructureParam, “Native Function” and more important “details”.

Additional:
I looked at everything I could from the Unreal Engine source codes. However, there is no “version” of “ArrayParm” and “ArrayTypeDependentParams” that applies to the case of my Wildcards and not just the Array.

What I wouldn’t like to use:
I saw that there is a super complex way to create a function that is using something related to “EdGraph”.

Thank you in advance for any comments or explanations.
Note: My sanity depends on the answer to this question. If not, I will be forced to throw something great out the window (in the trash).

Sincerely, HighRender.

This is a bit of a hack, but it looks like you can typebind any number of params together using The SetParam meta specifier.

UFUNCTION(BlueprintCallable, Meta=(SetParam="Arg1|Arg2|Arg3"))
static void Foo(int32 Arg1, int32 Arg2, int32& Arg3);

You can even have multiple groups of params, groups are separated by comma.

THANK YOU VERY MUCH!!! You saved my mental health. I spent all afternoon and night looking for this and all morning today too. I didn’t find anything regarding “SetParam”.

Now, additional questions if you would like to answer for me:
1 - Where did you find this “hack”? I didn’t find anything about this in the documentation or in the UE source code. Friend, I looked in everything I could. If there is some documentation explaining more about “meta”, I would be happy to read it. Well, the current documentation doesn’t show everything. I kind of have to keep guessing things (so far I’ve got it right, except for the “SetParam” one). lol
2 - When adding what you said, I noticed that a “symbol/icon” appeared at the bottom of my function (CompactNode), would it be possible to remove this icon? (If it doesn’t work, no problem. I’ve already managed to do what’s necessary with your great help).

Sincerely, HighRender.

Well I looked up source code about how ArrayParams/ArrayTypeDependentParams are handled, but they are coded into the CallArrayFunction node which is gonna be a problem. So then I moved to MapParam/MapKeyParam/MapValueParam, and SetParam. Turns out both are implemented in the CallFunction node so they can be used anywhere, and SetParam is pretty flexible as shown above. They are not restricted to being only on Map or Set arguments.

But as mentioned it’s a bit of a hack, there’s a possibility that Epic decides to create more specific CallMapFunction and CallSetFunction nodes, just like for arrays, and move the code there. If they do then it’ll stop working.

Dunno about the icon. Is it an error icon ?
While doing this I noticed that all input pins must be connected for some reason, even if you put in a default value. So maybe that’s the reason.

Thanks again for the explanation. Makes a lot of sense. I think it would take me millennia to find the “SetParam” in the “original files”. hahahaha

I just hope Epic is friendly and doesn’t remove the feature. It’s amazing and it will allow me to put into practice countless cool ideas from now on.

About the “icon” (Example):
Screenshot 2024-04-23 121953
It appeared in the background as you can see. The function “grew in size” in the test Event Graph.

Sincerely, HighRender.

That is normally controlled by the CompactNodeTitle meta specifier.

I searched the files for “CompactNodeTitle” and didn’t find anything relevant that would remove the background “icon”.

And believe me, going through the archives I found the “SetParam” thing by accident (referenced in one place, but I didn’t get to the location you mentioned. At least I think so). lol

I would like to add that I was able to remove the “error” when trying to remove one of the input connections. I added an extra code (which I already knew) and it simply resolved like a charm (I don’t know why, what matters is that it worked, hahahahaha). I felt like a genius at that moment.

Thank you in advance for your help. I won’t forget what I learned here today with you. I also believe that others (newbies like me) will get full benefit from this topic.

See you!!!