So the idea is, when I check ‘UseFootsteps’, the class should create the AudioComponent for it.
.h
UPROPERTY(EditAnywhere) bool UseFootsteps;
UPROPERTY(VisibleDefaultsOnly) UAudioComponent* FootSound;
.cpp
void ANpc::OnConstruction(const FTransform& Transform)
{
if (UseFootsteps && !FootSound) {
FootSound = NewObject<UAudioComponent>(this, UAudioComponent::StaticClass());
FootSound->RegisterComponent();
FootSound->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
}
}
With the above code, the component doesn’t appear in the hierarchy.
With ‘VisibleAnywhere’ all it’s stats appear in a big mess in the details panel though, which isn’t ideal.
Any ideas on the proper way to do this so it appears in the component list? Thanks!