I’m trying to add a USceneComponent to my Actor heirarchy, attached to the mesh to specify some positions for projectile starting points.
.h
UCLASS()
class ASTEROIDS_API AMySpaceship : public APawn
{
GENERATED_BODY()
....
public:
UPROPERTY(VisibleAnywhere, Category = "Components")
USphereComponent* CollisionComp;
UPROPERTY(VisibleAnywhere, Category = "Components")
UStaticMeshComponent *MeshComp;
UPROPERTY(VisibleAnywhere, Category = "Components")
USceneComponent *GunPositionComp;
}
.cpp
AMySpaceship::AMySpaceship()
{
CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("CollisionComp"));
CollisionComp->SetCollisionEnabled(ECollisionEnabled::NoCollision);
CollisionComp->SetHiddenInGame(true);
RootComponent = CollisionComp;
MeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MeshComp"));
MeshComp->SetCollisionEnabled(ECollisionEnabled::NoCollision);
MeshComp->SetupAttachment(CollisionComp);
GunPositionComp = CreateDefaultSubobject<USceneComponent>(TEXT("GunPositionComp"));
GunPositionComp->SetupAttachment(MeshComp);
}
However, in the editor the Component appears in the object heirarchy, but it’s entirely un-editable… it’s details pane is empty and it doesn’t appear in the viewport at all.
I eventually found it in the ClassDefaults pane before you open the full blueprint editor, but it’s just a white box with “none” in it. There is no way to edit it. All the other components appear as expected.
Does anyone know why the USceneComponent isn’t editable?