What does pure checkbox do and what advantages does it have

I understand const will help blueprint make sure we don’t modify any data.
Is the pure checkbox just for removing the execution pin?

Also what tactical advantage does pure function have? I only see it as a way to limit what the function is capable of doing but not sure why we want to do that.

Pure functions are functions that don’t “change state”. What this means is that they don’t modify value stored in the variables of your blueprint.

Examples of pure functions would be functions that only return a value or do a calculation but don’t need to store anything.

Functions that are Pure should also be const as well.

Bur wasn’t it shown in the lecture that just checking pure function allows for the state modification?
Only when we also check const, it started complaining that state modification is not allowed

You’re right. However, the idea of pure functions is that they don’t modify state. Marking as const allows that to be enforced. Which is why I (possibly poorly) tried to say that pure functions should also be marked as const for good measure.

Why this isn’t done automagically by UE, I don’t know.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms