Download

Pure casting pros?

Can anyone tell me why a pure casting would be more versatile? I get that it doesn’t require an execute input but is that it? Is it faster? I saw something about casting being slower than most functions, not sure if that’s true or not.

Cheers!

Use pure casting when you are 100% sure the cast won’t fail. That is my understanding.

I was surprised to see the cast node with exec pin put into a pure function and still work, and I understand in 4.6 cast can come as a pure node from the context menu.

So I wonder what other nodes can still function without an exec? Is this true for basically anything that has a variable in and variable out?

Thanks, do you know what the benefits are of doing it this way are though if you are indeed sure it won’t fail?

And I unfortunately have no answer for your question, hope someone else has input there. :slight_smile:

I can only speculate on how much performance you are gaining by using a pure over an executed cast. Perhaps better performance if it doesn’t have to make an extra check to see if it failed because it is assuming you set it up so that it won’t. If it does fail, things might not work and it won’t have a cast failed output to directly tell you what failed so you will have to keep that in mind. Probably also makes your graph cleaner since you can use 1 pure cast node and plug it in to several locations, and that might be a little more efficient on memory since less code needs to be stored but probably not even remotely noticeable.

It is slightly faster to pure cast. The impure cast checks to see if the return value is valid before returning it and routes to one or the other output execution pin. Validity checks aren’t done in the pure cast, so you’re saving a bit of time, miniscule as it may be. It mostly comes down to personal taste and your specific situation. Though if I were doing a LOT of casts at once and I knew the casts would be successful, I’d go with pures.

Easier to tidy up the Blueprint area too, without having to run through the cast execution pins! :smiley: