What's the difference between SetRootComponent () and RootComponent

What’s the difference between SetRootComponent () and RootComponent?
methods 1:
CollisionComponent = CreateDefaultSubobject(TEXT(“SphereComponent”));
SetRootComponent(CollisionComponent);
methods 2:
CollisionComponent = CreateDefaultSubobject(TEXT(“SphereComponent”));
RootComponent = CollisionComponent;

I used the first method to set the root component, but the tutorial I read used method 2, and I was wondering what the difference was between the two methods?

1 Like

At least is the same but SetRooComponent ensures that components owned by this actor can be used as a its root component and return a boolean if it has been assigned successfully.