How to access custom actor components through C++? (And general practice).

You can find a component on an actor like such:



if (MyCustomComponent* CustomComponent = HitResult.GetActor()->FindComponentByClass<MyCustomComponent>())
{
   // The actor had my custom component, do something with it.
   CustomComponent->DoStuff();
}