(Solved) What are componets in unreal?
I have a novice understanding of c++ and programming in general. I am confused by the syntax and functionality of components. Is this an unreal specific syntax. Is it even syntax or just some naming convention? I'm really just looking for a proper resource to understand their place in the unreal code and how to use them rather than just copying them down blindly.
This is an excerpt of the ue4 programming tutorial: /** StaticMeshComponent to represent the pickup in the level. */ UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup) TSubobjectPtr PickupMesh;
what I don't understand here is Is component a thing or just a naming convention? In the last line TSubobjectPtr PickupMesh; I understand(i think) that its a pointer, however im unfamiliar with the syntax. I've never seen pointers done in this way.
tldr; What does this code mean or where is the best place i can find out?
Unreal's C++ is actually C++ 11. However it uses a lot of macros and template classes, which is why it looks quite strange.
UPROPERTY, UCLASS, UOBJECT.. are unreal specific macros that are used for reflection. In the same way, TSubobjectPtr is a template pointer. Anything that starts with 'T' is a template class. They are all C++ constructs. You might want to go through the documentation to get a better idea about the various Macros and Template classes used in unreal.
However unlike normal C++ Unreal's C++ involves an additional step. ie Instead of directly compiling your code, Unreal generates some code based on your code by running the Unreal header tool. This is where the macros are parsed. Apart from that everything else is standard C++. But like any API, you need to get a good understanding of the API classes and functions in additon to language syntax.
Component: A component is a class (C++ class) which can be added to an Actor (another C++ class) to affect how the Actor behaves in the world.
Follow this question
Once you sign in you will be able to subscribe for any updates here