How to use Unreal Engine's API?


I like C++ because it is low-level and it provides an infinite amount of ways to do things. While for some crazy reason, that attracts me to C++, it has a very negative effect as far as reading different API’s.

Okay, so this is what I found for the API:

and this is an example that I was fact-checking things with according to the API above:

I attached an image on this page for convenience.

I was able to find AutoPossessPlayer located in the Pawn class. EAutoReceiveInput::Player0, I couldn’t find this no where in the API using the search feature.

RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT(“RootComponent”)); is another strange looking syntax for C++.

So basically, I’m trying to get good at using the API’s and using its members by looking at the rules provided.

I see classes declared as:

SomeClass class = new SomeClass();

and then you can start using its members like this:


Sometimes I see it declared as just this:

SomeClass class;

and then you can start using its members with just that.

For UE4, I haven’t seen any of the previous two that I just explained. I guess my frustration is coming from the fact that I seen dozens of foreign ways of using members, but I’m having a difficult time finding documentation on how to use it.
This leads me to google search it, which I can waste a lot of time reading forums that explains it incorrectly. I prefer to use the API, since it was made by people that is either the creator of the API or associated with them. I never had this problem
with Java. If the parameter required a boolean, you put in either true or false. If it is a double, you can put in 2.5, or 5. Simple!! I just wish I can find a resource that explains all of the infinite amount of ways that members can be used so that I don’t have to guess if the API doesn’t provide a comprehensive description on it.

I find the videos useful, but it is a bunch of typing in functions and telling you what they mean. They don’t really tell you how they came up with that function. I will never be competent with UE4, unless I can refer to the API.


Ok I’m not really sure what your exact question is, but I understand that you are confused by the code examples from unreal. Two things that might play a role: 1. The engine uses many features of C++ to get things done in a nice manner, some of which may look confusing at first if you don’t know them. 2. Unreal uses a custom preprocessor that adds extra functionality, for example exposing certain things to blueprint scripts, this might also seem confusing.

For your specific questions: EAutoReceiveInput is an enum, look here:

Read up on enums if you don’t know them, these are a basic C++ element.

RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT(“RootComponent”))

CreateDefaultSubobject is a template function. That’s a function that offers functionality for a bunch of different types. See C++ Templates
Unreal uses it a lot because it’s very useful…

TEXT is a macro I think, also a basic element of C++. . Macro’s are expanded by the preprocessor, so you can reuse small pieces of code that you use often, without making it a function (which is slower), search for C++ macro on google. Also read up on FString, FText etc. to see the different classes UE uses to work with strings (String Handling | Unreal Engine Documentation)

So nothing weird is going on here, it’s just a little more advanced c++ than you might learn from a basic textbook I guess. Just read about enums, templates and Macro’s… and for the custom preprocessor directives (stuff they put in front of many function declarations)… just believe they work as they explain. It’s not part of normal c++ but they made it pretty easy to use. You should be able to find how UE exactly turns these custom preprocessor directives into C++ code if you really want, but most users don’t do that I guess. It’s not neccesary to use them.

I believe many questions you have will be answered here, it helped me a lot when I started:

Especially slides 107->end