Weird error related to non-component subobjects in inherited blueprints.

Heya,
Last week I was mucking around with my default error logging settings and switched global to error instead of whatever it’s default is. It seems to have caused a couple checks to fail that previously weren’t, and it made me want to investigate why that was happening.

The major one I’ve run into is that we have a couple UObjects that we add to pawn classes as subobjects with CreateDefaultSubobject. They are not components, just straight up subobjects. Anyway, we end up hitting the check in Obj.cpp in the function “UObject::CheckDefaultSubobjectsInternal()”. It looks like it thinks we’re saving subobjects of other objects, but the other object isn’t another object it’s just the parent class data for our object.

I’m wondering if we’re just instantiating subobjects incorrectly, and I’d like to fix that if we are. I have a small project that exhibits the same behavior. In order to replicate the error, you have to add:



[Core.Log]
global=error


to the DefaultEngine.ini for the project. Then all you need to do is create a new blueprint class that inherits from MyCharacter.

Link to project.

Sorry if the link doesn’t work. First time using OneDrive to share stuff.

Any ideas what might cause this?

I’m on my phone so I can’t check your stuff out but have you tried just using NewObject?

It seems to still have the same issue. It looks like it is only an issue when you start trying to inherit things from the class you’ve added them to. I’m wondering if this might just be a weird case that might not be tested because it doesn’t happen often enough as you’d usually be sticking those things in a component, which seems to not trigger any of these checks.

Digging a bit more, what seems to be happening is that the base class (In my project MyCharacter) creates a default class object at compile time with its default sub object (TestSubObject in the project), and then when you try to inherit from it the Subclass of MyCharacter that you create uses the reference in the MyCharacter default object’s TestSubObject instead of its own.

Don’t have a huge amount of time to keep looking right now, but I’ll poke around some more when I get some free time and see if I can figure out why it’s referring to it’s parent CDO instead of its own. If I had to guess it’s some kind of optimization to reuse CDOs, but then the component checker probably just has to test against this case also.

Bumped into the same issue, and I suspect it’s stopping my LobbyPlayerController to be properly serialized,.and therefore transferred via seamless travel. Any updates on this? UE4.24.1