Difference between Pure and Const checkboxes for Blueprints

You can modify properties in a pure function (for example, in one of my project I call Set Owner in a pure function) but you cant set anything if you make it a const function. They are basically used as getters. Note that you can have Impure const functions too if you are certain that it wont modify anything

1 Like

Hello,

I am trying to find out if there is a difference between these two checkboxes. I can check both but I can tell the difference.

I know that pure blueprint functions should not modify the object propierties. But then, what does the const checkbox?

Thanks! Pretty clear now :wink:

Well this is weird, pure in general can’t modify any “outside” values. If it can, how is it different from impure ?

According to the patch notes…

Added “BlueprintPure=false” metadata
to allow const functions to be exposed
to Blueprints as non-pure.

indicates that the “pure” metadata was implemented not to make a pure function that is not const but to make a const function with execution pins.
The side effect of this was that you can remove the execution pins from an “impure” function which is odd indeed since now instead of explicitly having execution pins letting you know when the function modify something you have to look at how many wires are connected to the return value.

Pure functions that are not const should be called “Impure function without execution pins”. That combination is a bug waiting to happen since it is very misleading.

1 Like