Native components are editable when declared

90710-bp.png

I cannot change the properties of my CollisionBox in the editor. It says: “Native components are editable when declared as a UProperty in C++.”. But I DID declare it like that.

I did notice though that changing the TriggerShape in the editor requires an editor-restart for it to be visible in the editor… And then I also have all the other components. So If I changed from Box ==> Sphere I see them in the component-window but not in the viewport. After I restart the editor I have both a box and a sphere component and both visible in the viewport…
So something is really wrong. Not even the mobility is correctly set.

All I really want to do is just allow the editor to determine the collision-shape (box/sphere/capsule). That’s it.

My header code:

UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Waypoint")
UShapeComponent *WaypointArea;

UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Waypoint")
ETDCollisionShape TriggerShape = ETDCollisionShape::Box;

My cpp code:

void AWaypoint::CreateWPAreaComponent()
{
if (WaypointArea) { WaypointArea->DestroyComponent(); }

switch (TriggerShape)
{
case ETDCollisionShape::Box:
	WaypointArea = ConstructObject<UBoxComponent>(UBoxComponent::StaticClass(), this);
	break;
case ETDCollisionShape::Capsule:
	WaypointArea = ConstructObject<UCapsuleComponent>(UCapsuleComponent::StaticClass(), this); 
	break;
case ETDCollisionShape::Sphere:
	WaypointArea = ConstructObject<USphereComponent>(USphereComponent::StaticClass(), this);  
	break;
default:
	ULibraryObject::LogErrorSafely("Waypoint.cpp", "Missing switch-case.");
}
WaypointArea->AttachTo(RootComponent);
WaypointArea->SetCollisionProfileName("WaypointArea");
WaypointArea->SetMobility(EComponentMobility::Static);
}

Also I noticed that even though all the collision-shapes are attached to the root, moving the actor only moves the last-added-shape. The others remain in the zero-zero-zero coordinate. So they ARE attached to the RootComponent but the engine thinks they are not. Bug? Aside from the fact those other shapes should not even exist…

Also I noticed that after restarting the editor, the shape becomes editable… But restarting the editor for each waypoint that I place is not great. It’s almost as if I am missing some kind of Refresh(). I know it’s not

WaypointArea->RegisterComponent();

Because there is no world object at designtime. Or it has something to do with the absence of (which can not be used outside of the constructor):

CreateDefaultSubobject<>...