Download

[FEATURE REQUEST] Blueprint connectors for failure cases

There are some Blueprint objects which can silently fail to do their job and the chain just continues. Two of them are the “Spawn Actor” and “Teleport”.
Would be cool if we could easily handle cases where they fail (eg. because of collision). For example finding a start location would be much easier, if you simply can loop the player starts and abort as soon as it works instead of doing poor tricks with tags. (The size and amount of example on this topic are speaking for themself :slight_smile: )

Well, all these functions return bool value which indicate success/failure, I believe it is designed to use branch with this bool if you want to check condition of the function.

spawn actor returns the actor itself, not a boolean
right now, most spawning samples here in the forum are with “spawn even when colliding”=false. The chance that it sometimes fail seems pretty high to me, especially in multiplayer when there is a lot of respawning.

but yes, I was wrong with teleport, I obviously named the wrong one [and can’t remeber which one I meant, woops]

Oh, sorry, I’ve checked Teleport and assumed that Spawn Actor has same bool, my bad >.>’
But you could check actor existence with “IsValid” function which will give you 2 outpus for success/failure respectively :slight_smile:

you are right of course. It’s not as if we can’t work around it. But nonetheless, I like the failure-branch feature on cast nodes and would love to see it on other functionality, especially spawn actor.

speaking of Teleport, why has it an boolean output, spawnactor has no output (besides the actor) and cast nodes have two branches? it’s just not consistent

I’m totally agreed that it would be really good to have same use-experience for all these nodes, but there is quite a difference under the hood.
It just my opinion and I could be wrong somewhere, but:

Function “by default” could return only one output value so whenever you see multiple output values in BP it is some sort of workaround such as struct that has been split for visual coherence or value by reference from function parameter(input).

I believe BP version of Cast node is some sort of macro that contains pure cast(Which returns single value) + IsValid node that gives you 2 branches. It has built-in IsValid functionality because trying to access non-existing variable could lead to fatal errors so it’s just a foolproof mechanism. You could change Cast to “pure” to get rid of IsValid functionality so all listed functions will return single value (Yay consistency!)

SpawnActor returns single value as well - Spawned actor which could be processed through IsValid to get same behavior that Cast node has.

Teleport and many other UE4 functions just calculate some stuff or modify existing values so they have no object to return. And for very same reason you’ve described in first post, this “emptiness” is filled with bool value that indicate does function succeed or not.

To sum it up - all these functions has single value output in code, but Cast is modified for BP to decrease chance of user error.
Of course it possible to “macrofy” all the functions, but I’m not sure it worthwhile because you could add this functionality anytime with single node