How to find "GetComponentLocation()" function using the UE4 Documentation?

Hello Community!
How can I know that the “GetComponentLocation()” function exists, using the UE4 Documentation?

I am using VS Code and Intellisense is not working super all the time, so I like to reference the Documentation a lot. I think this also makes it a bit less dependent on the Environment you are coding in, instead of using ‘fussy search’ all the time.
Nevertheless, I was opening the UE Docs for UStaticMeshComponent and was searching for any getter-function that would give me any location or at least an FVector. But there wasn’t any.
I was even going up the hierarchy a bit to look for functions in UMeshComponent, UPrimitiveComponent and UObject, but couldn’t find any suitable function to get some kind of location.

After a while I gave up, hoping to get this issue explained. He was using intellisense to auto-complete the function. Easy one, but that is not working on my side.
So I searched for that specific function (well, now I knew it existed) and the UE Docs told me, that this function is part of USceneComponent. If I would have looked there, I would have found it, but …

  1. How can I possibly know that I have to look at (and only at) USceneComponent-Documentation to find a location-function for my UStaticMeshComponent?

  2. In generel, how do I know where to find the functions I need? What is the process? Really go up the whole hirarchy up to ‘UObjectBase’ to check if there is any function existing that I need?
    Because I am new to coding, I really don’t know what the normal process is in finding the functions you need. If I have used them before, yes, I know they exist and I can figure it out. But if I want to use a function first time, how do I know how the function that I need is called?

  1. The documentation shows you the hierarchy as it seems like you have found out. A class inherits all of the functions of the parent so if you don’t find anything that sounds like what you’re after look at the parent class, recursively.

    As you get more accustomed to Unreal things would be more obvious. As in your example you wanted the location so the first ActorComponent that has any sense of location is a USceneComponent

    A SceneComponent has a transform and supports attachment, but has no rendering or collision capabilities.

    So if had prior knowledge of that that would probably be the first spot to check.

  2. Honestly, Google usually takes you to the right place. Using your example and “get component location ue4” I get the docs for USeneComponent::GetComponentLocation() as the first result.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms