I made a simple custom class layout for a script object I am implementing. The following snippet is within the CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) method - it looks for an FName UPROPERTY named “Function” within the object, and then attempts to replace its widget with a custom one:
However my true intentions were to expose this script object as an instanced UPROPERTY, so that this custom selector is available from within other objects. When instanced as a variable in another object, the customization no longer works (in some ways that’s expected?) and the result defaults back to this:
How can I apply the customization in this scenario, it seems that implementing IDetailCustomization only works for the detail panel, and using IPropertyTypeCustomization only works for USTRUCTs, so I am out of options now.
I will say, I do have a workaround, but I really want to avoid using it - and that involves defining a wrapper USTRUCT with the properties I want to modify, and implementing a IPropertyTypeCustomization for it.
While we are on the topic of instancing, I might as well bring up another issue when it comes to displaying properties. Sometimes I notice inconsistency in that a variable that is Instanced within a USTRUCT does not generate the appropriate UI in the editor - I am unable to edit it at all.
Inside a blueprint editor, it appears fine as follows (although I just noticed it doesn’t create the categories correctly):
In some occasions, it was slightly better in that it showed me the property, but I couldn’t edit it. It ends up generating a selector that is greyed out and defaulted to “None”.
This is the header definition of the class I am basing my data table row on:
UCLASS(BlueprintType, Blueprintable, editinlinenew)
class MyGame_API UGameItem : public UObject { ... };
Then, for my data table row struct:
USTRUCT(BlueprintType)
struct FGameItemRow : public FTableRowBase
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, Instanced, Category = "Game Item")
class UGameItem* Item;
};
It really feels like there are some “conditions” for making this work right, thoughts?
Instanced properties do work inside structs, as long as the struct is again used as a property on a UObject. I wouldn’t expect data tables to support instanced properties.