How to use pure cast node

Hello everyone. I’m having some issues converting a normal cast node to a pure cast node.The note indicates that it causes the Blueprint to load all the time, what exactly does this mean, and can I use this node as a normal pure function?

I think the note is not about pure or non-pure. Casting to a class will load that class into memory, with all its references, doesn’t matter if it’s pure cast, or non-pure cast. It can be costy, but also neccessary for it to function.

However, if you’re using it incorrectly (for example, checking if an actor is a type of something) will result in loading in a lot of classes, without using them. There are a lot of explanations and tutorials on this topic, I’m sure you can google it, if you want more details.

1 Like

Someone corrects me if I’m wrong, please. @honya15 Cheers!

You’re right about how they execute (so in case of Select, both get executed, then decides which one to use), but AFAIK, it doesn’t matter if the Cast node gets executed or not.
When putting a cast node in your blueprint, the selected class gets marked as referenced by this blueprint, so when loading this blueprint, the referenced blueprint gets loaded too.
It doesn’t load the other class when the cast node gets executed, it loads during this blueprints loading.
You can right click on your current blueprint, and check the reference viewer, you will see the casted blueprint as referenced, and you can check the size map too.

1 Like

its not a big deal but id recommend against the using pure cast node , with a cast you’d usually want to save the reference anyway and you’d generally always want to validate it.

no doubt there are exceptions but i’d only use pure for very simple getter functions like bool checks