How it works...

As usual, we create some tagged UPROPERTY Components for our actor. In this case, we added an additional parameter to the tag called VisibleAnywhere, so that we can see our variables within the Details tab. We create two Scene Components and two Static Mesh components.

In the constructor, we create default subobjects for each component, as usual.

We then load the static mesh, and if loading is successful, assign it to the two static mesh components so that they have a visual representation.

We then construct a hierarchy within our Actor by attaching components.

We set the first Scene Component as the Actor root. This component will determine the transformations that are applied to all other components in the hierarchy.

We then attach the first box to our new root component and parent the second scene component to the first one.

We attach the second box to our child scene component to demonstrate how changing the transform on that scene component affects its children, but no other components in the object.

Lastly, we set the relative transform of that scene component so that it moves a certain distance away from the origin, and is one-tenth of the scale.

This means that in the Editor, you can see that the BoxTwo component has inherited the translation and scaling of its parent component, ChildSceneComponent.