How do I get a Player Character by net Id?

If I wanted to get a player character by their FUniqueNetId on a client, how would I go about making that possible in c++?

You need to search for all Character then check for there net id from PlayerState.

for (FConstPawnIterator It = GetWorld()->GetPawnIterator(); It; ++It)
{
	if (*It->PlayerState->UniqueId == CheckUniqueId)
              return *It;
}

Thanks for the response!
I have tried this method but GetWorld() is always returning null. I am lead to believe GetWorld is only something callable on the server, not too certain. Is there any other reason this would be happening?

depend on where you call GetWorld(), if it UObject normally it’s don’t have, only stuff that spawn into the World will have this like actor, pawn,…, you can do other way by this

UWorld* World = GEngine->GetWorld();

I will try this tomorrow, I have tried a couple of different approaches already using GEngine->GetWorld() in actors and other places, but I have not tried GetWorld directly from actor. If it returns a non null value then this will be answered.

This works wonderfully! Thank you, you should note in your answer that accessing the playerstate directly from any pawn returned will cause errors, and check for a playerstate after casting to a character for your code to work: