Array of Instances vs Classes? How are they defined?

I have the following exposed from C++ to Blueprint:



USTRUCT(BlueprintType)
struct FOreMineral
{
	GENERATED_USTRUCT_BODY()
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TSubclassOf<UBaseItem> Mineral;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	float MineralPercentage;
};
// .......snip....

	// Minerals that can be in this ore
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Composition")
	TArray<TSubclassOf<UBaseItem>> PotentialMinerals;
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Computed Composition")
	TArray<FOreMineral> Minerals;


In Blueprint, if you grab the PotentialMinerals, it gives you an array of Class, rather than Instance. But if you grab the Minerals array, and break the struct, then Mineral is exposed as an Instance and not a Class.

Both are defined the same way (Other than the containers), so why is one different than the other? How is this determined?

TSubclassOf will give you a Class that inherits from the specified class, whereas the Minerals variable is a TArray of plain ol’ FOreMineral objects. If you changed it to be TArray<TSubclassOf<FOreMineral>>, it’d do the same.

If you want to get PotentialMinerals the same way, you could just have a TArray<UBaseItem>, and cast them in blueprint (although I’m not sure if it’ll treat them as they are or consider them as references/pointers. You’ll need them treated as the latter if they’re to be casted).

Can you post an image of what you’re seeing in the blueprint? From the code you post, that shouldn’t be the case, and I honestly don’t see how it could be.

@: I think you misread the code, he’s referring to the ‘Mineral’ property within FOreMineral, which is also a TSubclassOf.

Apparently I must have been crazy last night because I look at it this morning and both are returning a Class and not an Instance. Which is actually a problem because I do want the Struct property Minerals->Mineral to be an Instance not a class, as the intention was to store a reference to an instantiated item in there.

Using TSubclassOf is the only way I can allow the designer to assign BP subclassed versions (IE a Blueprint made from UBaseItem) to the array.

Actually I may be getting caught up in concepts and terminology here and how they apply in UE vs general coding. I need to step back and do some tests.