Description

When a mesh is declared in a custom component class and that component is added to an actor class, compiling a blueprint based on the actor class will cause the mesh set in the component to vanish in the editor.

Regression:
No - Behavior occurs in 4.14.3 Binary (CL 3249277)

Steps to Reproduce
  1. Open UE4 Editor (any project)
  2. Add two code classes based on Actor and SceneComponent (MyActor & MySceneComp)
  3. Add the following to MyActor.h
    • Add include statement for MySceneComp
    • UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test)
      	UStaticMeshComponent* ActorMesh;
      
      UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test)
      	UMySceneComp* ChildScene;
      
  4. Add the following to MyActor.cpp (in the constructor)
    ActorMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("ActorMesh"));
    	RootComponent = ActorMesh;
    
    ChildScene = CreateDefaultSubobject<UMySceneComponent>(TEXT("ChildScene"));
    	ChildScene->SetupAttachment(ActorMesh);
    
  5. Add the following to MySceneComp.h
    • UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
      	UStaticMeshComponent* ChildMesh;
      
  6. Add the following to MySceneComp.cpp (in the constructor)
    • ChildMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Child"));
      	ChildMesh->SetupAttachment(this);
      
  7. Compile
  8. Create blueprint based on MyActor (MyActorBP)
  9. Set any mesh for ActorMesh and Child components (Child component needs to be set through the ChildScene details panel)
  10. Compile blueprint

Result:
Mesh set to Child will vanish from the viewport at compile

Expected:
Both meshes remain visible after compiling blueprint

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

9
Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.15.1
CreatedMar 29, 2017
ResolvedAug 18, 2021
UpdatedAug 18, 2021