%s has a reference to default subobject (%s) of %s

I am relatively new to Unreal Engine and working in a quite big project. The other day when hunting a bug in a different castle, I turned on all the logging and found a about 30 log errors from module LogCheckSubobjects (together with a breakpoint hit inside UObject::CheckDefaultSubobjectsInternal() on a CompCheck(OtherReferencedSubobjects.Num() == 0), stating something in the form

Error: ObjectProperty /Script/Engine.ExpressionInput:Expression has a reference to default subobject (Class /Script/Engine.MaterialExpression) of Package /Script/Engine.

The comment above the checks read like this:

	// Check for references to default subobjects of other objects.
	// There should never be a pointer to a subobject from outside of the outer (chain) it belongs to.

So I guess there is some issue with holding pointers to subobjects… but what is the issue? Why should there never be such a pointer? How else would you reference subobjects?

As expected, a search in docs.unrealengine.com for LogCheckSubobjects yields 0 results. (Actually UE-30888 but that seems to be a different issue).

Now, I already found this blog post where the author Jonathan Hale talks about this issue, and that he “solved” it by declaring some UPROPERTY to be writable, but I can’t make up from the blog what the problem is actually about here. After reading the post, I am even more confused, because declaring the reference writable (although he did not have the intention to write on it) would make it even less sense (for a default object), right?

Also, his solution doesn’t really apply here, as I am not doing any blueprint scripting and the property in question is not even in my source, but in the engine code (we compile the engine from source). I assume its

UPROPERTY(transient)
class UMaterialExpressionFunctionInput* ExpressionInput;

from struct FFunctionExpressionInput?

Anyway, can someone explain me, what LogCheckSubobjects does, why its an error to have a reference to a default subobject and how the appropriate solution is?

For my case of this error helpful answer was in this thread: Packaging Error: archetype is not the CDO nor a default subobject of my class

1 Like

Thanks a lot, you saved so much time for me.
This is quite unexpected that level loading process starts crashing when user enables or disables global logging.