I have a couple custom actors which are derived from AActor. They are also derived from a non UClass which I will call “FMyClass”.
I want to use a dynamic cast from “AActor” to “FMyClass” and I have tried the following:
AActor* actor... FMyClass* myClass = Cast<FMyClass>(actor);
However it seems Cast only works on UObjects as it needs the “StaticClass” function.
So I tried dynamic_cast instead:
AActor* actor... FMyClass* myClass = dynamic_cast<FMyClass*>(actor);
This time around I get the error:
‘dynamic_cast’ used on polymorphic type ‘AActor’ with /GR-; unpredictable behavior may result
Anybody knows how I am supposed to properly cast it? Or perhaps I should find a different approach?