Download

CanEditChange for UProperty inside a TArray - what's the index?

I’ve got a setup like this:


USTRUCT()
struct FStuff
{
    UPROPERTY(EditAnywhere)
    bool bBoolProperty = false;

    UPROPERTY(EditAnywhere)
    float FloatProperty = 1.0f;
};

UCLASS()
class UThing : public UObject
{
    UPROPERTY(EditAnywhere, Category="Foo")
    TArray<FStuff> Stuff;

    virtual bool CanEditChange(const UProperty* InProperty) const override;
}

When editing the Stuff array in the editor, CanEditChange gives me a UProperty* (either FloatProperty or BoolProperty) to inspect, but I’m not sure how to tell which array element the property is actually in. Is this even possible?

I’m trying to replicate EditCondition behavior so I can do some more advanced checks. This would require looking at other values in the modified struct to determine whether editing is OK.