Subobjects vs Components.

A little background in the logic that will be used here. An apple is a fruit, but a fruit isn’t necessarily an apple, or, a foo is a bar, but a bar isn’t always a foo.

I presume this somewhat accurately describes the relationship between sub-objects and components, but I lack the experience to be sure. I maintain that Components are sub-objects, but sub-objects can be more than just components (meshes, volumes, fog, clouds etc…). It’s an important detail if you’re interested in design patterns / OOP. Personally, at this point I’m more interested in the broad-sweeping ideas behind UE4 types/patterns than specific programming idioms.

A component is a type of subobject, as you say. Here is how the names are generally used in the UE4 codebase:

A subobject is any UObject that has an Outer that is not a UPackage. UPackages are the top level of the hierarchy, and refer to a .uasset file on disk, or the transient package. For instance, AActors are subobjects in a ULevel, which is a subobject in a UWorld, which is a subobject in a UPackage. So they can be nested arbitrarily. Most assets like Meshes, textures, etc are not sub objects as they are nested directly inside a UPackage.

A component is anything that is a subclass of UActorComponent, and is a subobject of UActor. We don’t have any components that are not ActorComponents.

5 Likes