Cannot use Hit.Item in my linetrace C++

Hi,
I’m relatively new to C++, and am currently loosing my mind trying to access the (int32)Item value from a FHitResult. I know my linetrace works ( *Hit.GetActor()->GetName() returns the correct object), but if I try logging *Hit.Item, I’m getting the following error pointing at the UE_LOG line: “error C2100: illegal indirection” .

  FHitResult Hit;
  if (GetWorld()->GetFirstPlayerController()->GetHitResultUnderCursor(ECollisionChannel::ECC_Camera, true, Hit))
    	{ 
    		UE_LOG(LogTemp, Log, TEXT("%s"), *Hit.Item);
    	}

That’s because Item is an int32. The %s refers to a String or a Char.

Replace “%s” with “%d” and remove the pointer from Hit.Item.

Like this:

 UE_LOG(LogTemp, Log, TEXT("%d"), Hit.Item);

Ah … I feel dumb ahaha
Thank you that was it!

No need to feel dumb. When I started, I struggled with this too :wink: