Simple GetComponentsByTag C++

This is probably a very easy answer, but I am not good at C++ and after going over some tutorials and documentation, I still keep getting errors with this.

All I need to do is get the player character and then find all scene components (on the player) with the tag “GrabObjectPivot” and add those to an array.

void APickupObject::SetPlayerGrabComponents()
{
	ACharacter* playerChar = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);
	TArray<USceneComponent*> Components = playerChar->GetComponentsByTag(USceneComponent::StaticClass(), FName("GrabObjectPivot"));
}

I thought this would do the trick, but I keep getting an error saying “no suitable user defined conversion from TArray UActorComponent* to TArray USceneComponent*.” I guess that doesn’t make sense to me because wouldn’t the “GetComponentsByTag” return scene component values based on the actor I put in?

Apparently GetComponentByTag always just returns as UActorComponent, which doesn’t really matter in this instance, but if I specifically need to access certain component parameters I guess I would need to manually cast afterwards.

You can cast inline as well

				USceneComponent* SceneComponent = Cast<USceneComponent>(Character->GetComponentsByTag(USceneComponent::StaticClass(), FName("MyComponent")[0]);