Isn't IsValid safer than ! in an unreal context?

I was just wondering, if I read doc correctly IsValid will ensure its a valid taking into account if it’s getting killed etc. but is technically not null at that point so would be true when using bang or putting it first in the if statement? (and reads better for intent in the if statement I think)

IsValid | Unreal Engine Documentation

Also for development ensure and ensureAlways look useful as they generate a proper dump automatically if they are not true with a bunch of information. I tried those on the pressure plate scenario and it gives everything you need to debug it.

Asserts | Unreal Engine Documentation

If it has a potential to be destroyed during runtime, yes. However I don’t think that’s situation that comes up in Building Escape.

2 Likes

Thanks!, that makes sense.

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

Privacy & Terms