Why do we have to create pointers for U and A prefixed classes and non pointers for F prefixed structs?

I really need an elaborated explanation why we have to create pointers for U or A prefixed classes but non pointers for F prefixed structs?

Quoted from Romero’s Very Nice Tutorial:

In Unreal Engine, the structures are represented by types that have the prefix F as FVector and FTransform for example. If you use a type/class that has the prefix U or A, you must create a pointer. But for types prefixed with F, you don’t need to create a pointer.

The short answer is: because that’s the way Unreal works.

The longer answer is that one of the points of the Engine is to manage objects for you and to do that it needs to be hooked into the creation of any UObjects (AActors are a subset of these). On the other hand, the engine supports structures as strictly value types and therefore doesn’t have to do anything special when one is created. This means to can declare instances of structures directly, whereas for Objects or Actors you have to call NewObject or SpawnActor. Since those two functions return pointers, you’ll never have an instance of those types by value.


Thank you very much for your useful answer. Let me wait for a couple of hours to decide it as a solution.

Because U and A represent classes, unctions, large items and the F represents what is in the functions , vectors, rotators and so on. U also represent objects like meshes scene components and so on.

Why create a pointer for a vector, a vector is just a line between two points.
Why would you store in a memory address just a vector.

I think they are too simplistic to be stored as pointer address in ram, they are stored anyway, because all of them are stored there, but without making a refrence where it is (pointer refrence)

Functions get stored because they have parameters, and you can call on those parameters from another function, and if they are loaded into memory with a pointer, you don’t have to do anything, you just get direct memory address and you got the function with it’s params, that may inlcude (F stuff)

I don’t understand, what is stopping you from creating a pointer address and storing a vector there ? You can create it with *, and then refrence it. and you have it there inside the ram with the hex address and you can have acces to it either by refrence * or with this operator → that is also C++ standard operator for memory address access in C++

1 Like

Thank you very much.