[PCG]: Unable to use Attribute property overrides to target nested struct properties, such as BodyInstance.CollisionProfileName

There appears to be a bug in the validation of PropertyOverrides in UPCGMeshSelectorByAttribute::SelectInstances, specifically:

  • Line 190: “if (FPCGSoftISMComponentDescriptor::StaticStruct()->FindPropertyByName(FName(PropertyOverride.PropertyTarget)))”
    • This assumes that the PropertyTarget is not nested within a struct of the descriptor.
    • The actual override logic supports taking a nested property path and navigating it to do the get/set functionality

Proposed fix:

  • Add a method in PCGAttributeAccessorHelpers for IsValidPropertyTarget (see code below)
  • Call this new helper method on Line 190 in place of the old code as such: “if (PCGAttributeAccessorHelpers::IsValidPropertyTarget(PropertyOverride.PropertyTarget, FPCGSoftISMComponentDescriptor::StaticStruct()))”

We have confirmed this worked in our project and property resolves nested property paths for validation.

`bool PCGAttributeAccessorHelpers::IsValidPropertyTarget(const FString& InPropertyPath, const UStruct* InStruct)
{
const FPCGAttributePropertySelector OutputSelector = FPCGAttributePropertySelector::CreateSelectorFromString(InPropertyPath);
const TArray& ExtraNames = OutputSelector.GetExtraNames();

bool bIsValid = false;
if (ExtraNames.IsEmpty())
{
bIsValid = IsPropertyAccessorSupported(FName(InPropertyPath), InStruct);
}
else
{
TArray PropertyNames;
PropertyNames.Reserve(ExtraNames.Num() + 1);
PropertyNames.Add(OutputSelector.GetAttributeName());
for (const FString& Name : ExtraNames)
{
PropertyNames.Add(FName(Name));
}

bIsValid = IsPropertyAccessorChainSupported(PropertyNames, InStruct);
}

return bIsValid;
}`

Steps to Reproduce
1) Setup a PCG graph, which places static meshes

2) Add Attributes to the output of the create points grid for CollisionProfileName

3) On the Static Mesh Spawner node, setup a Static Mesh Component Property override:

  • Input Source: CollisionProfileName
  • Property target: BodyInstance.CollisionProfileName

Results: When placing an instance of this graph in a world, you get errors on the “Static Mesh Spawner” node related to:

  • “Property ‘BodyInstance.CollisionProfileName’ not a valid property with an ISM Descriptor. It will be ignored.”

Hi,

Thank you for the repro steps and suggested fix. I created a bug report for this issue, with your proposed fix, that can be tracked here if/when it’s approved for public visibility: Unreal Engine Issues and Bug Tracker (UE\-296837\).

There is no ETA as priorities for bugs and features can shift at any time.

Regards