class ARMYSIMUL_API UItemObject : public UObject
first, I made class derived from UObject.
class ARMYSIMUL_API AItemPickup : public AActor, public IInteractive
// Sets default values for this actor's properties
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
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?
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 (
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