Though AActor::AddComponentByClass() is tempting to use, you should note that epic says specifically not to call this function directly: