Hiding UObject* instanced property class-selector dropdown.

I found a solution for anyone who might be looking for the same thing:

void FTestObjectStruct_DC::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
	TSharedPtr<IPropertyHandle> UObjectParamHandle = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FTestObjectStruct, NewTestObject));

	if (UObjectParamHandle.IsValid() && UObjectParamHandle->IsValidHandle())
	{
		UObject* UObjectValue = nullptr;
		UObjectParamHandle->GetValue(UObjectValue);

		if (UObjectValue)
		{
			UClass* ObjectClass = UObjectValue->GetClass();
			for (TFieldIterator<FProperty> PropIt(ObjectClass); PropIt; ++PropIt)
			{
				FProperty* Property = *PropIt;
				TSharedPtr<IPropertyHandle> ChildHandle = UObjectParamHandle->GetChildHandle(Property->GetFName());
				if (ChildHandle.IsValid())
				{
					StructBuilder.AddProperty(ChildHandle.ToSharedRef());
				}
			}
		}
	}
}
2 Likes