UE4 API Guide/Help?

Before I knew much about UE4 beyond the main editors and such, I had begun to invest time into learning C++. However, now that I’ve began to learn how to apply C++, many tutorials exist, but there’s something many of them lack; an explanation. I find it hard to know when to use macros like UObject() and UProperty() when I’m given literally no definition or explanation of the macro itself. Even if a tutorial tells me specifically where to put the macro, when I’m on my own I won’t know where to put it and why I would put it there anyway. Can anyone explain (although I understand this would take a significant portion of your time) or possibly point me to a document, or multiple documents, explaining the usage of such things.

You should use UPROPERTY() on any exposed property or anything that might be referenced by the engine. If it’s a pointer to a UObject, use UPROPERTY(). If it’s exposed to the editor, UPROPERTY(). If another class references it, UPROPERTY(). Err on the side of having it rather than not having it I guess, although someone might like to offer a better answer than this. :slight_smile:

The short of it is, if you tag a property with UPROPERTY then garbage collection will do a better job of not mowing through all of your objects whenever it feels like, since it’ll be tracking references between them.

There isn’t a ton of documentation like what you’re looking for. It’s around, but if you’re like me and need to read things phrased in several different ways before you understand it then you’re out of luck. The best you can do is start working with it and ask question, read other questions and answers, feel your way through it. It’s totally doable.

Antidamage’s answer is much more accurate than mine. However, I tend to think of UPROPERTY and UFUNCTION as the way to expose my property or function to the blueprint editor. I can set the property/function with many options such as ‘ReadOnly’ or ‘Editable’, and then use them or change the values while in the editor. It’s a great way to play with values or settings without having to quit the editor or recompile.