Overriding a subobject's class in a native base class can lead to that component being null in derived Blueprints. 

Steps to Reproduce

General Summary

  • Create a native base class "MyActor" with a default subobject
  • Subclass MyActor and override the subobject's class via FObjectInitializer::SetDefaultSubobjectClass "MyDerivedActor"
  • Create a Blueprint based on MyDerivedActor (BP_MyDerivedActor)- note that the subobject is valid
  • Close the editor
  • Change MyDerivedActor's subobject class once again to a different class via FObjectInitializer::SetDefaultSubobjectClass
  • Launch editor - open BP_MyDerivedActor and note that the subobject is now null

Using Attached project

  • Download and Unzip InitRepro and generate project files (built against 4.26.2 CL# 16092969) 
  • launch the editor 
  • Open BP_MyDerivedActor and note that the "PathFollowingComponent" subobject is valid. (For convenience you can press the PIE button to print out the subobject's class name)
  • Close the editor
  • Open MyDerivedActor.cpp
  • Comment out the constructor that overrides the subobject class to UGridPathFollowingComponent and Uncomment the constructor that overrides the subobject's class to UMyPathFollowingComponent.
  • Compile and launch editor
  • Open BP_MyDerivedActor and note that the "PathFollowingComponent" subobject is null.

Have Comments or More Details?

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

Login to Vote

ComponentUE - Gameplay - Blueprint Compiler
Affects Versions4.265.1
Target Fix5.2
CreatedJun 10, 2021
ResolvedMay 3, 2022
UpdatedAug 26, 2022