Is it Impossible to use "UObject Derived Class" in Blueprint As object reference?

UCLASS(Blueprintable, BlueprintType)
class ARMYSIMUL_API UItemObject : public UObject
{
GENERATED_BODY()

public:
	UItemObject();
....

first, I made class derived from UObject.

UCLASS()
class ARMYSIMUL_API AItemPickup : public AActor, public IInteractive
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AItemPickup();

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
		UItemObject* ItemObject;

...

then I Made Actor class Having Reference Pointer for my Custom UObject Class.

After that, I Also Made “Actor Blueprint” And “MyUObject Blueprint.”

I Dragged “MyUObject Blueprint” class to “Actor Blueprint” 's Detail Panel, but I Can’t Assign it To “Actor Blueprint” As Object Reference.

Is it something like a bug? or I Made a mistake?

306216-3.png

This is normal, blueprint can not guarranty that object you refrence will exist at runtime so you can not refrence it in class defaults. But if you would place actor on the level you can reference other actors on that level (allowing actor linking)

For defaults you need either refrence a class (UClass* or TSubclassOf<>) and at runtime create object, soft reference (TSoftObjectPtr<>) which can softly reference to elements of level asset and have controllable invalid state if asset is missing or not loaded.

There also option t use CreateDefaultSubobject<>() in constructor, same as you do to create components in actor, which will create new object instance together with parent object, this function is not really made specifically for components. But this might not be reflected into blueprints as they not support those other then for components.

Thank you. I’ll Do with other Methods

I know this post is 2 years old, but I came accross it randomly while googling about something completely unrelated, and it was the first result, so I thought I’d reply anyway in case anyone else has this issue.

This is the case where you use TSubclassOf<>; then you can drag the UObject class there, and at runtime Instantiate it with NewObject<>
ie:

class ARMYSIMUL_API AItemPickup : public AActor, public IInteractive
{
	GENERATED_BODY()
public:
	AItemPickup();

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item")
	TSubclassOf<UItemObject> ItemObject;

	//this will return a brand new item that you can do something with.
	UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Item")
	UItemObject* GetItem(UObject* Owner); 
UItemObject* AitemPickup::GetItem(UObject* Owner)
{
	//Create runtime version of my item, at spawn.
	if (ItemObject != nullptr)
	{
		return  NewObject<UItemObject>(Owner, ItemObject);
	}
	return nullptr;

to use it, you can just call the pickups GetItem function, passing the owner that the new item should belong to. Ie: your weapon actor, or character pawn, etc