Getting variables from unspawned actor component

This is our problem:

TestComponent has a set of variables we would like to access from other blueprints.

TestSubclassA has a ‘TestComponent with the set of variables modified’
TestSubclassB has a ‘TestComponent with the set of variables modified’

TestSubclassZ has a ‘TestComponent with the set of variables modified’

We would like to create a function which says “Given this class, return the values of the variables contained in TestComponent” - taking a class reference variable as input.

The TestSubclasses are unspawned when this function needs to be called, so using interfaces, construction scripts, functions called by BeginPlay etc are not an option.

Spawning an instance of the class to pull variables from its component before deleting it is not an option as this would affect many other functions in the game.

Each TestSubclass has majorly different functionality so having all inherit from the same base class is not an option.

Can anyone help with a solution?

You have a bunch of options from C++ such as this:

auto Default = GetDefaultMutable<UTestComponent>();

From Blueprints I don’t know; maybe you need a custom Blueprint node to do that…
Try the “Construct Object from Class” node to get class default values.

Thanks for the suggestion! Is there any documentation for this anywhere?

E: is this function in the UE4 4.12.5 engine code? Cannot find any mention of it and it returns undeclared identifier.

Using a custom blueprint node is very simple to do this.
You just get an TAssetPtr and if the asset is valid you call .Get() function to return the default object from that asset/blueprint class.
But C++ required… Every class has an unspawned default object, Blueprints seem to not have access to get defaults.
Maybe Rama’s custom blueprint library has a node for that already, I don’t know.