Description

Runtime-generated components stored in ObjectPtr with VisibleAnywhere are displayed in the details panel, but not for arrays.

Applying the following workaround, components can be visible even in arrays.

FProperty* FComponentEditorUtils::GetPropertyForEditableNativeComponent(const UActorComponent* NativeComponent)
{
	// A native component can be edited if it is bound to a member variable and that variable is marked as visible in the editor
	// Note: We aren't concerned with whether the component is marked editable - the component itself is responsible for determining which of its properties are editable	
	UObject* ComponentOuter = (NativeComponent ? NativeComponent->GetOuter() : nullptr);
	UClass* OwnerClass = (ComponentOuter ? ComponentOuter->GetClass() : nullptr);
	UObject* OwnerCDO = (OwnerClass ? OwnerClass->GetDefaultObject() : nullptr);

...

		// We have to check for array properties as well because they are not FObjectProperties and we want to be able to
		// edit the inside of it
		if (OwnerCDO != nullptr)
		{
			for (TFieldIterator<FArrayProperty> PropIt(OwnerClass, EFieldIteratorFlags::IncludeSuper); PropIt; ++PropIt)
			{
				FArrayProperty* TestProperty = *PropIt;
//				void* ArrayPropInstAddress = TestProperty->ContainerPtrToValuePtr<void>(OwnerCDO);
				void* ArrayPropInstAddress = TestProperty->ContainerPtrToValuePtr<void>(ComponentOuter);	//workaround

				// Ensure that this property is valid
				FObjectProperty* ArrayEntryProp = CastField<FObjectProperty>(TestProperty->Inner);
				if ((ArrayEntryProp == nullptr) || !ArrayEntryProp->PropertyClass->IsChildOf<UActorComponent>() || ((TestProperty->PropertyFlags & CPF_Edit) == 0))
				{
					continue;
				}
Steps to Reproduce
  1. Compile and open the repro project on ue5 [Link Removed]
  2. Once opened the editor, Start PIE session
  3. Press Detach from the player controller button (or press F8 key)
  4. Select BP_ThirdPersonCharacter on outliner
  5. See details panel

Result:

Runtime generated components are not visible in details pane.
[Link Removed]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-158069 in the post.

1
Login to Vote

Fixed
ComponentUE - Gameplay - Components
Affects Versions5.0
Target Fix5.3
Fix Commit25287196
Main Commit25288926
CreatedJun 30, 2022
ResolvedMay 1, 2023
UpdatedMay 3, 2023
View Jira Issue