UUIComponents - Inheritance does not work correctly with UPROPERTIES

Hi Support,

I have noticed with UUIComponents if you extend a super with a UPROPERTY, then use that new class on a widget, then modify the UPROPERTY in editor, after a compile it will just clear the value.

I would expect it to retain the value otherwise Inheritance has no point with UPROPERTIES

Thanks

Steps to Reproduce

  1. Create a UUIComponent Super class e.g.

```

class UMyCoolComponent : public UUIComponent

{

UPROPERTY(EditAnywhere, BlueprintReadWrite)

FString SomeThing;

}

```

2) Extend that superclass e.g.

```

class UDownstreamComponent : public UMyCoolComponent

{

}

```

3) Observe that if you attach it to a Widget in Unreal Editor, edit the property, compile it clears all values.

Hi,

It looks like UI components haven’t been set up to handle inheritance particularly well. Fixing this particular problem should be a one line change in UUIComponentContainer::GetComponent:

if (Target.GetTargetName() == TargetName && Target.GetComponent()->GetClass()->IsChildOf(ComponentClass))That said, this won’t play well with cases where both the base and derived component are on the same widget, which probably shouldn’t be supported in the first place. I’ll see if I can get this cleaned up a bit and send a CL your way once it’s available.

Best,

Cody

Oops, good point; we added UE_LOGF in CL# 48471708 if you want to grab that as well, we’ve since converted most uses of UE_LOG in the codebase. If cherrypicking that turns out to be a can of worms, the backup plan would be to just fix up that log statement with a comment and clean it up when the merge conflict happens down the line.

Hi,

I’ve got some changes checked in at CL# 53217422 if you want to cherrypick that. In addition to properly migrating properties on derived components, we now both disallow multiple components in the same inheritance hierarchy (i.e. you can’t have both UMyCoolComponent and UDownstreamComponent on the same widget), and the component picker will no longer show ineligible component classes. Let me know if you have any thoughts on those changes.

Best,

Cody

Testing now but found a potential bug in this CL, UE_LOGF was put in BlueprintExtension.cpp, replaced with UE_LOGFMT as i cant see any existing usages of UE_LOGF? (is there a import we need to cherrypick for this)

Also there is a warning `0>UIComponentWidgetBlueprintExtension.cpp(96,63): Warning C4996 : ‘UObject::IsDataValid’: Please use the the const version of IsDataValid(FDataValidationContext&) - Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.` that i’ve fixed locally

Just updating, this worked. Thanks