Hi everyone!
I am using UE 5.1. In my map, I have an APickup
actor instance with a UPickupComponent
actor component:
This component has the following instanced UPROPERTY()
:
// Used as template to create the pickup when spawned in.
UPROPERTY(EditAnywhere, Instanced)
TObjectPtr<UInventoryItem> _itemTemplate = nullptr;
, where UInventoryItem
is a UObject
with the following specifiers:
UCLASS(Blueprintable, EditInlineNew, DefaultToInstanced)
class INVENTORYCORE_API UInventoryItem : public UObject {
// ...
}
Now, since I am using Instanced
along with EditInlineNew
and DefaultToInstanced
, I expect to be able to select my _itemTemplate
property from the dropdown menu:
For example, by selecting BP_HealthPotion
, I expect the _itemTemplate
pointer to point at a BP_HealthPotion
instance.
However, as soon as I select any value, the editor automatically changes it back to None.
backToNone.mkv (1.6 MB)
My question is: Why is this happening? Am I doing something wrong? Or is this some kind of bug?
I tried digging a bit into the engine code, following the call stack that leads to my component’s PostEditChangeProperty()
. I noticed that from FPropertyValueImpl::ImportText()
I get to FObjectProperty::ImportText_Internal()
with the Result
local variable storing what I expect. However, when the Data
variable is fed to FObjectProperty::GetObjectPropertyValue()
, I get a NULL
ObjectValue
, which I believe is what causing the problem.
Any ideas?