Hey,
I have been banging my head trying to get this to work.
I'm trying to have a dynamically spawned UObject of a type specified by a TSubObjectOf have it properties show in a details panel.
But all that will show are the Properties of the base class, not the sub class given given from the TSubObjectOf
Small example below.
The 2 UObject I want to display
UCLASS(Blueprintable, editinlinenew)
class UTestBaseClass : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Test")
FVector BaseClassTest;
};
UCLASS(Blueprintable, editinlinenew)
class USubClassTest : public UTestBaseClass
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Test")
FVector SubClassTest;
};
The class that holds them
UCLASS(Transient)
class UTestToolProperties : public UInteractiveToolPropertySet
{
GENERATED_BODY()
public:
UTestToolProperties();
UPROPERTY(EditAnywhere, Category = Options)
TSubclassOf<UTestBaseClass> ObjType;
UPROPERTY(Instanced, EditAnywhere, Category = Options)
TObjectPtr<UTestBaseClass> TestObj;
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override
{
Super::PostEditChangeProperty(PropertyChangedEvent);
if (PropertyChangedEvent.Property->GetName() == "ObjType" && ObjType != nullptr)
{
TestObj= NewObject<UBrushGen>(ObjType);
}
}
};
The problem is that I can only ever get it to show the properties of the UTestBaseClass, I was hoping I could have it use the reflection data of the class given by TSubclassOf<UTestBaseClass> ObjType, but no luck.
I have also tried to use detail customization to have it show them that way by adding AddExternalObjectProperty, but no luck.
I can loop over all the properties, I just can't see a way to have them display in details view.