New blueprint node: "Switch Node"

A node letting you switch among other nodes based on a value would save a lot of code and mess. I think it is clearly explained in the attached images.

The node would be named something like “Switch Node” of an invalid type, until you set its type and then would become: Switch Name_of_the_type, like in the image bellow where it became “Switch Mess”.

Thanks :wink:

Uhh maybe I misunderstand your Question, but you have a “select node” WTF Is? Select in Unreal Engine 4 ( UE4 ) - YouTube

Yeah you’re looking for the Select node. But be careful - despite what it picks based on the index, all paths are evaluated before one is picked.

Thanks for the fast answer, so yes, Select seems exactly what I was asking for.

Select seems to help a lot with organization (and prevent bugs, since less nodes around), but if it is that bad for performance… I will check, and thanks for the advice ;).

Just be careful when using pure functions or complex graphs as inputs.

Because they would be reevaluated for each Select condition, isn’t it? (Need to test on the engine itself). If so, it seems a good idea to use a local variable to store the result and use that for the Select and similar nodes.

BTW, after testing the Select node, it could be useful to have a Default exec pin which would be called if none of the cases is matched. What do you think?

You can also use “Switch on Int”, which does exactly the same as “Select”, but in an Impure matter and also has the ability to define a Default behaviour