But I can’t understand why this returns a UActorComponent and not a UPrimitiveComponent.
Also a related question - the only difference in the documentation between GetComponentByClass() and FindComponentByClass() seems to be that FindComponentByClass() is a “native version of GetComponentByClass”. But what does “native version” mean here?
Whereas FindComponentByClass has a template version and will return whatever the template argument T* happens to be. Basically, it does the cast for you.
GetComponentByClass is exposed to blueprint. GetComponentByClass just calls FindComponentByClass, so native = native to the engine/C++.
Where would I be able to find that function declaration?
The documentation “remarks” section for GetComponentByClass says:
“Searches components array and returns first encountered component of the specified class”. This feels misleading because it sounds like you should be able to specify what class you want to return.
I don’t understand what a template version is (can you point me towards more info?) but it would be helpful to have the difference between template version/non template version in the documentation, is it documented somewhere else?
Also, the function declaration that you posted above has a parameter of “TSubclassOf ComponentClass” and I thought that UPrimitiveComponent was a subclass of UActorComponent because it inherited from UActorComponent
Thanks, the above is helpful. Where did you get this information though (or rather, how could I find the same info)? The specific info that I’d like to be able to look up is the content of the functions, so for example this bit:
Similarly, where I said “Where would I be able to find that function declaration?” above, I meant where do i go to look up the declaration and definition of GetComponentByClass(), i.e. where did you pull the following line from?