The real problem of blueprint CastTo

Curious, what did you benchmark there? In the editor with all other things running at the same time it’s hard to be accurate… maybe when testing a million runs I don’t know XD.

There’s something else going on with interfaces, in c++ you have to do multiple checks to get a proper interface cast depending on if the interface is blueprint only or not. Extremely frustrating.

bool bCanBeGrabbed = false;
if (OtherOwner->Implements<UGrabInteractionInterface>()) {
	bCanBeGrabbed = IGrabInteractionInterface::Execute_CanBeGrabbed(OtherOwner, InPrimitiveComponent);
}
else if (const IGrabInteractionInterface* OtherInterface = Cast<IGrabInteractionInterface>(OtherOwner)) {
	bCanBeGrabbed = OtherInterface->CanBeGrabbed(InPrimitiveComponent);
}
2 Likes