Download

Unity -> Unreal Documentation

So I was combing over the docs this morning and I found this pretty brutal conversion.

UMyComponent* MyComp = Cast<UMyComponent>(MyActor->GetComponentByClass(UMyComponent::StaticClass())); is so terrible (even for us C++ programmers) and crazy intimidating for C# only unity scripters.

Fortunately we already have a templated equivalent in to the Unity version.

That line should really read:

So much better!

Cheers,

/ Kyle

I’ve poked the docs team about fixing this.

You are even more right than you realize as GetComponentByClass is almost a duplicate of the untempalted version of FindComponentByClass, except a number of subclasses don’t override it, meaning different (and likely undesirable) results. I’m tracking down why GetComponentByClass even exists.

Thanks for pointing this out.

Thanks Marc!