I created a class as follows:
UCLASS(config = Game)
class FPTEMPLATE_API AFPTemplateCustomCharacter : public ACharacter {
GENERATED_BODY()
/** Thing 1 */
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Mesh, meta = (AllowPrivateAccess = "true"))
class UPoseableMeshComponent* PoseableMeshComponent;
/** Thing 2 */
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Mesh, meta = (AllowPrivateAccess = "true"))
class UPoseableMeshComponent* PoseableMeshComponent2;
public:
// Sets default values for this character's properties
AFPTemplateCustomCharacter(const FObjectInitializer& ObjectInitializer);
/ * declaration of virtual methods follows... */
};
The constructor initializes the two poseable meshes as follows:
AFPTemplateCustomCharacter::AFPTemplateCustomCharacter(const FObjectInitializer& ObjectInitializer)
: ACharacter(ObjectInitializer.DoNotCreateDefaultSubobject(ACharacter::MeshComponentName)) {
PrimaryActorTick.bCanEverTick = true;
PoseableMeshComponent = CreateOptionalDefaultSubobject<UPoseableMeshComponent>(TEXT("PoseableMeshComponent1"));
if (PoseableMeshComponent) {
PoseableMeshComponent->SetOnlyOwnerSee(false);
PoseableMeshComponent->SetupAttachment(GetCapsuleComponent());
PoseableMeshComponent->VisibilityBasedAnimTickOption = EVisibilityBasedAnimTickOption::AlwaysTickPose;
PoseableMeshComponent->bCastDynamicShadow = true;
PoseableMeshComponent->CastShadow = true;
PoseableMeshComponent->bAffectDynamicIndirectLighting = true;
PoseableMeshComponent->PrimaryComponentTick.TickGroup = TG_PrePhysics;
static FName MeshCollisionProfileName(TEXT("CharacterMesh"));
PoseableMeshComponent->SetCollisionProfileName(MeshCollisionProfileName);
PoseableMeshComponent->SetGenerateOverlapEvents(false);
PoseableMeshComponent->SetCanEverAffectNavigation(false);
}
PoseableMeshComponent2 = CreateOptionalDefaultSubobject<UPoseableMeshComponent>(TEXT("PoseableMeshComponent0"));
if (PoseableMeshComponent2) {
PoseableMeshComponent2->SetOnlyOwnerSee(false);
PoseableMeshComponent2->SetupAttachment(GetCapsuleComponent());
PoseableMeshComponent2->VisibilityBasedAnimTickOption = EVisibilityBasedAnimTickOption::AlwaysTickPose;
PoseableMeshComponent2->bCastDynamicShadow = true;
PoseableMeshComponent2->CastShadow = true;
PoseableMeshComponent2->bAffectDynamicIndirectLighting = true;
PoseableMeshComponent2->PrimaryComponentTick.TickGroup = TG_PrePhysics;
static FName MeshCollisionProfileName(TEXT("CharacterMesh"));
PoseableMeshComponent2->SetCollisionProfileName(MeshCollisionProfileName);
PoseableMeshComponent2->SetGenerateOverlapEvents(false);
PoseableMeshComponent2->SetCanEverAffectNavigation(false);
}
}
I then created a blueprint that inherits from this character subclass in the Unreal Editor. In the blueprint, only PoseableMeshComponent2 has “Details” that I can edit. The first one does not. This is in spite of the fact that their declarations/uproperties appear to be identical.
I was able to resolve this by renaming PoseableMeshComponent to PoseableMeshComponent1, triggering re-compile, and then renaming it back and compiling again. This kind of behavior is very disconcerting though. Is there something I am doing wrong? I should note that in the process of doing this, the unreal editor also crashed a few times for an unknown reason.
Thanks for your help.