Unreal declare ActorComponent in c++ not show in detail panel UCLASS(config = Game, Blueprintable)

Unreal declare ActorComponent in c++ not show in detail panel

UCLASS(config = Game, Blueprintable)
class PROCEDURALLEGCRAWL_API AProceduralCrawlActor : public AActor
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, Category = "Leg")
	float a;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Leg")
	TObjectPtr<UStaticMeshComponent> Thigh;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Leg")
	TObjectPtr<UStaticMeshComponent> Knee;

	UPROPERTY(EditAnywhere, Category = "StepConfig", meta = (ClampMin = 0.01f))
	float StepTime;
......

private:
	float PlantLocation;
};

I Just want declare an ActorComponent, then the detail panel show it, just like a variable.

If you’re creating those components in the constructor as default sub-objects, you want your UPROPERTY markup to be BlueprintReadOnly & VisibleAnywhere. Not EditAnywhere. If you edit those properties you can cause any blueprints of that class to become corrupted.

The properties of the component will still be editable even though the component pointer itself is only marked as visible.