Why won't UDrawSphereComponent move in editor?

Hi there folks,

Built my editor from 4.1 source and I’m having a strange issue.
I’ve created a class called Node_Navigation which extends off of AActor.
In the header file I define a UDrawSphereComponent so that I can visualise where the node is placed in the editor (as it will have no StaticMesh).

Header

UPROPERTY(VisibleAnywhere, Category ="UDrawSphereComponent")
TSubobjectPtr<UDrawSphereComponent>  RadiusComponent;

Cpp

PrimaryActorTick.bCanEverTick = true;

RadiusComponent = PCIP.CreateDefaultSubobject<UDrawSphereComponent>(this, TEXT("RadiusComponent"));
	RadiusComponent->SetSphereRadius(50);
	RadiusComponent->ShapeColor = FColor::Black;
	RadiusComponent->SetMobility(EComponentMobility::Movable);

Everything compiles correctly, when I get in the editor and drop a Node_Navigation into the world, it spawns at world zero and while I can move the component around , the UDrawSphereComponent doesn’t follow. Any leads ?

#Make it the RootComponent

RootComponent = RadiusComponent;

or if you have other components, one of which already is the RootComponent

#AttachParent

RadiusComponent->AttachParent = RootComponent;

:slight_smile:

Rama

That did the trick , thank you for sharing Rama ! :slight_smile:

Hee hee!

:slight_smile:

Rama