Am I setting myself up for failure by making a 'Call Function by Name' function?

Hey there folks.

It’s a topic I have seen pop up a few times during my initial research but for some reason there is no ‘Call Function By Name’ node available in blueprints despite how incredibly useful it sounds.

I have seen some folks say I could use the ‘Set Timer By Function Name’ node to emulate a similar result but this felt incredibly hacky to me and so I decided to make my own function as an opportunity to learn how plugins are made.

Sure enough, we eventually got there in the end. Takes a reference to the blueprint holding the function I am looking for and the name of said function as inputs, executes the function and returns True if the function was executed without incident.

image

Now the question is, I am setting myself up for failure? Is there a good reason why this very basic node is not available as a baseline? Was it simply never implemented? Is it secretly the devil’s work and it will come to bite my in the behind 600 functions down the line?

I’d appreciate expert input on this matter.

Thank you, and take care.

Did you see this?

2 Likes

I have now, but that’s not what I am asking about. My current implementation works too.

1 Like

If this implementation works at all, then likely it’s ok.

I don’t know the epic’s position, but i think that the rough idea is that c++ has no build-in reflection system, hence there is no such things like FindByName by default. But epics need it and they did implement their own system. And since it’s the system “on the top of” of all existing engine code\language, in some cases it will cost you a some part of perfomance to use it.
A simple direct call will definitely be faster than seaching through reflection by string name among all the functions your object has.

1 Like

I added some information to that topic you shared, alternative implementations.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.