Convert string to Unique Net ID

Hi, is there a way to convert a string to a variable “Unique net ID” ?

There’s a way to convert the variable “Unique net id” to string, but i can’t find the opposite.

Thanks in advance.

For Steam, there is this node if you use Advanced Steam Friends Library

image

1 Like

For NonSteam, there is C++ way

.h

	TSharedPtr<const FUniqueNetId> CreateUniqueIdFromString(const FString& StringId) const;

.cpp


TSharedPtr<const FUniqueNetId> UMyClass::CreateUniqueIdFromString(const FString& StringId) const
{
	if (OnlineSubsystem)
	{
		const IOnlineIdentityPtr IdentityInterface = OnlineSubsystem->GetIdentityInterface();

		if (IdentityInterface.IsValid())
		{
			return IdentityInterface->CreateUniquePlayerId(StringId);
		}
	}
	return nullptr;
}

Online subsystem should be available using this code

IOnlineSubsystem* OnlineSubsystem= IOnlineSubsystem::Get();
1 Like

Thank you.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.