Download

StaticMeshComponent not being correctly created?

I’ve defined two StaticMeshComponents in my header file, and set them up correctly in my .cpp file.

Header



public:
FORCEINLINE UStaticMeshComponent* GetPerigeeBillboard() const { return PerigeeBillboard; }
FORCEINLINE UStaticMeshComponent* GetApogeeBillboard() const { return ApogeeBillboard; }

UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = "TLE Visualization")
UStaticMeshComponent* PerigeeBillboard;

UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = "TLE Visualization")
UStaticMeshComponent* ApogeeBillboard;


CPP Constructor



ApogeeBillboard = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("ApogeeBillboard"));
GetApogeeBillboard()->bAbsoluteLocation = true;
GetApogeeBillboard()->AttachParent = CollisionSphere;

PerigeeBillboard = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PerigeeBillboard"));
GetPerigeeBillboard()->bAbsoluteLocation = true;
GetPerigeeBillboard()->AttachParent = GetCollisionSphere();


However, the resulting blueprints don’t allow me to actually access any of the details of the mesh at all, and what’s strange is if I make it an ‘EditDefaultsOnly’ Property, I am given the option to use a dropdown box of different childs of the StaticMeshComponent class, which when selected created broken instances of the static mesh component.

Components View - No Details?
Capture.JPG

Details Panel View - None, Or drop-down box when set to 'EditDefaultsOnly’
ad136de9af490a9dea6d523ebdb3f4c266bba00e.jpeg

Any ideas why this is? I have another class that uses this exact same set-up (but only one mesh), and it exposes the details panel just fine!

You likely don’t want to make components EditDefaultsOnly (or any other editable). The resulting behaviour is an editable pointer to a component, not editable component contents, meaning you could set the component to null or some other undesired behaviour. Try VisibleAnywhere, that’s what static mesh actor uses. I don’t think the special inline component edition triggers for VisibleDefaultsOnly.

That explains the Drop-Down boxes then… though still doesn’t cover why I can’t edit any of it’s properties.

I’m starting to think it’s a bug now, despite having other objects with static mesh components declared in exactly the same way :confused: