What is CastChecked <>()

There doesn’t seem to be anything online about CastChecked.
Can someone explain for future readers?

Probably an internal function to check if cast function fails or succeeds

All you have to do is

AMyClass* cl = Cast<AMyClass>(Other);

and unreal does the asserts behind your back :stuck_out_tongue:

CastChecked is exactly what it says, it’s a checked cast. It’s the equivalent of:

ptrA = Cast< type >( ptrB );
check( ptrA != nullptr );

It’s not an internal function but you do have to be pretty sure that the cast is going to succeed.

4 Likes