Download

Unable to use pointer to UUserDefinedStruct derived type like an asset in details panel

I am specialising UUserDefinedStruct to use as an asset type in my plugin, lets call it UMyStructType. I want to re-use this built-in type (and eventually DataTables too) but provide it to my users as an asset type that fits in with the other bespoke ones in my plugin (matching icon, extra methods, etc). Having done this I want to then be able to select from the assets the user has created of type UMyStructType in the details panel of other objects (e.g. actor property or BP node). So the other classes would contain a UPROPERTY something like UMyStructType* DataType; Unfortunately, this property appears as a drop-list of ALL structure types (over a thousand) and doesn’t even filter down to only assets based on UMyStructType. I’d like it to appear as a proper Asset property that supports the preview and the ability to drag-drop assets from the Content browser, and filtered down to the compatible assets.

Having examined the internal code closely, I believe this comes down to UUserDefinedStruct deriving from UScriptStruct and the logic in SPropertyValueWidget::ConstructPropertyEditorWidget succeeding at SPropertyEditorStruct::Supports before it succeeds at SPropertyEditorAsset::Supports. Looking further I can’t see any possible way to customise/intercept this process and force it to prefer the Asset property widget.

Ideally there’s be a metadata check in SPropertyEditorStruct::Supports that could be used to suppress matching as a struct and leave it to match as an asset instead.

I hope this makes sense. Please can you advise.

Sam

Details: This is based around the UE4.25.4 codebase.