Information about root component

I am having hard time understanding root component. Can someone explain me in easy terms,please? Can’t find any good tutorials on it. Also what do VisualMesh->SetupAttachment(RootComponent); && Mesh->AttachTo(Root); mean? Thanks :slight_smile:

So , When You Code An Script in CPP/BP .The Script is running behind the scene when you Press Play Button In Editor(PIE) .The Scrip itself dose’nt have any ability to do thing in 3D Enviroment in Editor(PIE). You Can Imagine Scrip like an empty shell .The Way you Create things in Ue4 is using Comoponents.
Let’s assume You Make an Code
with

TSubcalssof<UStaticMeshComponent> Visual Mesh;

With This you’re creating an meshcomponent but that meshcomponent can’t move freely in Editor.So For that We Attach it to RootComponent To give it permmison to do so.
like this:-

VisualMesh->SetupAttachment(RootComponent);
  1. Script Dosen’t have anything to do in UE4. besides giving commands/instruction to actor
  2. Root Component is Componet that have location, rotation, scale. Whereas other component Dosen’t Have Those.
  3. For this Problem Unreal Decided to use Rootcomponent for giving permission to Other Component.