Problems Trying To Generate List Of Component Socket Pairs In Actor Component

Hello, I feel like I am trying to do something impossible, but I want to see if anyone has any insights anyways. I am trying to create a hit detection component and allow the user to specify what sockets they want to use for tracing. I’ve setup a struct with a component name and socket name property and I’m trying to use the GetOptions meta specifier to generate an array of names for the components.

	UPROPERTY(EditDefaultsOnly, DisplayName="Component", meta=(GetOptions="HitDetection.HitDetectionComponent.GetOwnerComponents"))
	FString ComponentName;
	UPROPERTY(EditDefaultsOnly)
	FName Socket;

I found a function from this post that gets all the components from a blueprint generated class. Here is my slightly modified version:

TArray<FString> UHitDetectionComponent::GetOwnerComponents()
{
	UObject* OwnerObject = GetOwner();
	TArray<FString> Result = {};

	UBlueprintGeneratedClass* BlueprintGeneratedClass = Cast<UBlueprintGeneratedClass>(OwnerObject);
	UE_LOG(LogTemp, Warning, TEXT("Gets here"))
	if (!BlueprintGeneratedClass) return Result;
	UE_LOG(LogTemp, Warning, TEXT("Gets here too"))
	
	TArray<UObject*> DefaultObjectSubobjects;
	BlueprintGeneratedClass->GetDefaultObjectSubobjects(DefaultObjectSubobjects);

	// Search for ActorComponents created from C++
	for (UObject* DefaultSubObject : DefaultObjectSubobjects)
	{
		if (DefaultSubObject->IsA(USceneComponent::StaticClass()))
		{
			Result.Add(DefaultSubObject->GetName());
		}
	}
        
	// Search for ActorComponents created in Blueprint
	for (USCS_Node* Node : BlueprintGeneratedClass->SimpleConstructionScript->GetAllNodes())
	{
		if (Node->ComponentClass->IsChildOf(USceneComponent::StaticClass()))
		{
			Result.Add(Node->GetVariableName().ToString());
		}
	}
        
	return Result;
}

The problem is it requires a call to GetOuter() which isn’t allowed for static classes (Since I’m using a struct the GetOptions needs to point to a static function).

I tried to set a static OwningObject variable in the constructor but it seems to fail to cast it to a UBlueprintGeneratedClass.

I also tested with just an internal string using non static functions and it works just fine, but I can’t pair the socket names with that.

Any Suggestions?

Thanks