Developer Notes

The reason this fails is because the Static Mesh Component header is missing. Add #include "Components/StaticMeshComponent.h" to the top of the Actor's header file.


Starting a hot reload by clicking the Compile button in the Editor fails after adding a Static Mesh Component to an Actor code class. This only occurs in the binary version of the Engine, and only if the project was originally a Blueprint-only project. The error does not occur if the project was originally a code project, or if the Engine was built from source code.

Yes, this error did not occur in 4.19.2.

Steps to Reproduce
  1. Create a new Blank Blueprint project.
  2. Add a new Actor code class to the project.
  3. Add a Static Mesh Component property to the new Actor class.
    • eg:
      UStaticMeshComponent* MyMesh;
  4. Create a default subobject for the new Static Mesh Component and set it as the root component.
    • eg:
      MyMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MyMesh"));
      RootComponent = MyMesh;
  5. Click the Compile button in the Editor.

The build fails with the following error: error C2440: '=': cannot convert from 'UStaticMeshComponent *' to 'USceneComponent *'

The build completes successfully.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-65826 in the post.

Login to Vote

CreatedOct 25, 2018
ResolvedOct 26, 2018
UpdatedOct 29, 2018