How to initialize UObject reference properties in the editor

I have an AActor-derived class which has a custom UActorComponent-derived component created in its C++ constructor. I want this component to have a property of type UMyObjectBase*, which is derived from UObject. In the editor, when modifying defaults/details of this actor, I want to be able to set this property to be an object of any type derived from UMyObjectBase, and then also be able to modify the properties of the selected derived type. Every instance of the actor should get its own instance of the derived type object, initialized to the properties set in the editor.

What I’ve done:

  • UMyObjectBase has UCLASS specifiers BlueprintType and EditInlineNew.
  • The UMyObjectBase* property of the component has the Instanced specifier.

It mostly works, but I have the following problems.

  1. In order to assign a default to my object property, I used CreateDefaultSubobject() in the component’s constructor, to create an instance of a chosen derived class. My understanding is that property values assigned in a constructor will be overwritten by those specified in the editor details panel of an actor placed in the level. However, while this behaved as expected within the editor, as soon as I hit play the component property in-game used that assigned in the constructor rather than the one set in the details panel. Further, when I saved, closed and reloaded the project, the value in the details panel had reverted to the constructor default.

  2. If instead of constructor defaults, I create a blueprint derived from my actor class, the object property gets reset to ‘None’ on recompilation of the blueprint. It seems to be the same as the issue here. Is there anywhere I can track the progress of that issue? It seems like a pretty significant bug.

Any suggestions on anything I’m misunderstanding appreciated.

Appears to have been fixed as of version 4.7.