Download

GetDefaultObject equivalent for BP Actor?

Hey there,
I am working on a (physically represented) storage system and for the sake of cheap saving and some other benefits I experimented with reconstructing my “representations” without having an actual Actor of the respective class, or in other words: only saving Class and Amount. It’s a bit more complicated but that’s the basic idea. For this I need to procedurally look at the Components of an Actor but only by having the Class at hand. I don’t want to actually spawn each Actor for this. The issue I encountered though, is that the DefaultObject ( Class->GetDefaultObject() ) of and Actor class is “incomplete” for Actor classes that were created in blueprint.
For example let’s say we have a c++ Actor called “SomeActor” and a BP child of this called “SomeActorBP”. SomeActor has an attached component called “SomeComponent” and SomeActorBP has an additonal attached Component called “SomeOtherComponent”.
If I then have a ref to the class of SomeActorBP and would call GetDefaultObject() on it I receive an Object of the class SomeActorBP but it would only have the SomeComponent attached and not the SomeOtherComponent.
This really bugs me since the code works so neatly for my c++ classes and it’s kinda hard for me to accept that I can’t make it work for BP Actors as well.
So my question is: Is there a way to see what components a BP Actor has attached with only having the class at hand and NOT spawning an Actor into the world?

Thanks for any responses :slight_smile:
Heiner Lohmann