AI perception get sense class fails to compare with it's static class

I am trying to compare the output of ai perception update info and when I am testing the static class of the sense to withe output from the perception it fails.

void AZombieAIController::PerceptionUpdated(TArray<AActor*> UpdatedActors)
{




	auto TempPerceptionComponent = GetPerceptionComponent();

	check(TempPerceptionComponent);

	for (auto SensedActor : UpdatedActors)
	{
		FActorPerceptionBlueprintInfo PerceptionInfo;
		if (TempPerceptionComponent->GetActorsPerception(SensedActor, PerceptionInfo))
		{

			for (int32 i = 0; i < PerceptionInfo.LastSensedStimuli.Num(); ++i	/*auto Info : PerceptionInfo.LastSensedStimuli*/)
			{
				auto Info = PerceptionInfo.LastSensedStimuli[i];

				auto SensedClass = UAIPerceptionSystem::GetSenseClassForStimulus(this, Info);

				if (SensedClass)
				{
					bool SuccessfullySensed = Info.WasSuccessfullySensed();
					bool isSight = (SensedClass->GetClass() == UAISense_Sight::StaticClass());
					if ( isSight) // alywasfals
					{
1 Like

Solved!

You need to use

(SensedClass == UAISene_Sight::StaticClass)