UActorComponent get USceneComponent?

How you can access USceneComponent from UActorComponent?

You have UActorComponent* and you want to treat it as a USceneComponent*?

If you know for a fact that it is a USceneComponent you can do:



USceneComponent* SceneComponent = CastChecked<USceneComponent>(Component);
SceneComponent->DoSomething();


If you just want to check if it is you can do:


bool bIsSceneComponent = Component->IsA<USceneComponent>();

And if you want a pointer to that SceneComponent in a safe method you can do:



USceneComponent* SceneComponent = Cast<USceneComponent>(Component);
if (SceneComponent)
{
   SceneComponent->DoSomething();
}


Oh thanks for reply! I need to familiarize a bit with those Unreal templates:)