Hide struct properties in detail panel

Hey yall,

I’m trying to work on a UActorComponent and have two structs I’ve made as UPROPERTY’S on the component, one struct has a “Target” property which is an AActor* reference, and the second property in the struct is an array of enums InputEvents. I’ve also got a third property on the component called EntityType, which is using an enum.

What I’m trying to do is whenever the Target property of the struct is changed, I get the actor that has been referenced and attempt to grab the UActorComponent of the same type as this one from the actor, and if it’s found, I check the EntityType value on that component, and based on that value, I want to change the enum that the InputEvents property from the struct on this component is using…

I’m kind of doubtful whether a property on a struct can be changed, but if it can be then that would be awesome, otherwise alternatively… Perhaps I can include all the enums on the struct, then use detail panel customization to hide all the enums on the struct except one?

This is what I’ve got so far…

#if WITH_EDITOR
void UIOSystem::PostEditChangeProperty(struct FPropertyChangedEvent& e)
{
	Super::PostEditChangeProperty(e);
	FName PropertyName = (e.Property != NULL) ? e.Property->GetFName() : NAME_None;

	if (PropertyName == GET_MEMBER_NAME_CHECKED(FInputsStruct, Target))
	{
		for (int i = 0; i < Inputs.Num(); i++)
		{
			if (Inputs[i].Target != nullptr)
			{
				UActorComponent* component = Inputs[i].Target->FindComponentByClass<UIOSystem>();
				UIOSystem* ioSystem = Cast<UIOSystem>(component);

				if (ioSystem != nullptr)
				{
					switch (ioSystem->EntityType)
					{
					case EEntityType::Door:
						// Switch enum to door events enum
						UE_LOG(LogTemp, Warning, TEXT("Type is a door"));
						break;
					case EEntityType::Light:
						// Switch enum to light events enum
						UE_LOG(LogTemp, Warning, TEXT("Type is a light"));
						break;
					default:
						UE_LOG(LogTemp, Warning, TEXT("Please set an Entity Type!"));
					}
				}
				else
				{
					UE_LOG(LogTemp, Error, TEXT("There is no IO System component on the Target Actor"));
					Inputs[i].Target->Reset();
				}
			}
		}
	}
}
#endif

It’s during the switch case that I need to change the structs enums or hide the structs properties in the details panel…

Suggestions?

Ok solved this one by following this tutorial on Struct / detail panel customization here, with that I was able to create a variable to hold the enum value of the Target whenever it was changed in the SetOnPropertyValueChanged event, then in the CustomizeChildren call, I used that enum to perform a switch case and set a TSharedPtr to use whichever struct property I needed based on the enums case.