GetHitProxy(),How use it?

i want to get mouse hit by HitProxy,Here is my code.
AActor* UVictoryBPFunctionLibrary::GetViewportHit(const APlayerController * ThePC,int X, int Y)
{

	if (!ThePC) return nullptr;
	FViewport * VictoryViewport = ThePC->GetWorld()->GetGameViewport()->Viewport;
	if (!VictoryViewport) return nullptr;
	VictoryViewport->InvalidateHitProxy();
	HHitProxy* HitProxy = VictoryViewport->GetHitProxy(X, Y);
	HActor* ActorHitProxy = (HActor*)HitProxy;
	if (!ActorHitProxy) return nullptr;
	AActor* ConsideredActor = ActorHitProxy->Actor;
	return ConsideredActor;
}

is a static function,i can run it,but i print result actor display name,always “Brush1”

help ,please

Is it possible the query is hitting a hid element? Brush1 might refer to a slate element.

Thank you for your reply. I used a default empty scene, unless I used the wrong viewport, but I couldn’t find anything else.

Is it possible to post your entire project so I can debug the issue on my end?

The whole project is too large, this is a static function, can be copied and used directly, you can try.only need include“Engine.h”

Do you fix it?