# What's the difference between SetRootComponent () and RootComponent

**URL:** <https://forums.unrealengine.com/t/whats-the-difference-between-setrootcomponent-and-rootcomponent/451679>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 4, 2019, 3:24pm UTC](https://forums.unrealengine.com/t/whats-the-difference-between-setrootcomponent-and-rootcomponent/451679 "2019-07-04T15:24:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_shi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Daniel\_shi](https://forums.unrealengine.com/u/Daniel_shi)\
**Post date:** [July 4, 2019, 3:24pm UTC](https://forums.unrealengine.com/t/whats-the-difference-between-setrootcomponent-and-rootcomponent/451679/1 "2019-07-04T15:24:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e89d5ce7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e89d5ce7](https://forums.unrealengine.com/u/anonymous_user_e89d5ce7)\
**Post date:** [November 22, 2020, 12:11pm UTC](https://forums.unrealengine.com/t/whats-the-difference-between-setrootcomponent-and-rootcomponent/451679/2 "2020-11-22T12:11:45Z")

</div>

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.
