I want to Cast a AActor object point to a child class AMyActor.In Bluepoint,this function can inspect the object is a AMyActor object or not. It’s a safe function to help us cast object`s class.but in c++,i had not find this function.I need to use some function I declarated in AMyActor,but I have not define input object is or not is AMyActor object. So I need to Cast to AMyActor and adopt different strategies based on success cast or failure cast.
Casting and calling function:
AMyActor* castedActor = Cast<AMyActor>(the_actor_to_be_casted);
if (castedActor)
{
castedActor->function_defined_in_AMyActor();
}
Yes. You can do this:
AMyActor a = Cast(MyActor);
This will cast the MyActor object from AActor to AMyActor