About ensure

Hello every one!
I want to ask why do we use the following construction : if (!ensure(TriggerVolume != nullptr)) return;
instead of that: if(TriggerVolume = nullptr) return; ?
Thanks!

You can certainty just do a plain if (TriggerVolume == nullptr) if that’s how you want it.

However there are some differences. ensure causes UE to do its own thing and there are three types of ensure.

https://docs.unrealengine.com/en-us/Programming/Assertions

The most simple one used here "Verifies the expression and if it fails generates a callstack leading to that point. "

The non-use of ensure doesn’t do that by itself.

2 Likes

Thanks, its pretty usefull information for me.

1 Like

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

Privacy & Terms