Page MenuHomeFeedback Tracker

Fix GetPlayerUID returning empty string in Workbench
Assigned, NormalPublic

Description

GetGame().GetBackendApi().GetPlayerUID(playerId) is not returning the correct playerId in the Workbench. Both with or without playing on a localhost server.

It would be nice if the ID is returned from the BI account that is currently signed into the workbench. It could return the same ID for all peer clients you connect or intentionally offset their GUIDs by the peer number so their hash is somewhat "unique" but still deterministic based on the main Workbench's BI-ID.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor created this task.Jun 1 2022, 10:35 PM
Geez changed the task status from New to Assigned.Jun 2 2022, 1:48 PM
Arkensor added a subscriber: Geez.Jul 21 2023, 11:09 AM

Heya @Geez,

this task can get an update internally. If intended or not the BI UID now returns in the workbench and local game host etc, but one frame after where it is supposed to be available.
We were told on multiple occasions that the event SCR_BaseGameMode.GetOnPlayerAuditSuccess() would be the first and proper one where the call to GetGame().GetBackendApi().GetPlayerUID(playerId) should return correct data. This is correct on DEDICATED servers but not in WB and SP. There right now I need to do this workaround:

m_pGameMode.GetOnPlayerAuditSuccess().Insert(SomeCallerWrapperFor(WaitForUid));

//------------------------------------------------------------------------------------------------
protected void WaitForUid(int playerId)
{
	// Wait one frame after audit/sp join, then it is available.
	GetGame().GetCallqueue().Call(OnUidAvailable, playerId);
}

//------------------------------------------------------------------------------------------------
protected void OnUidAvailable(int playerId)
{
string uid = GetGame().GetBackendApi().GetPlayerUID(playerId); // Here it works yay!
}

So maybe there is just a tiny bug remaining why the info is not available in the workbench on the same frame. If that could be fixed some day that would be lovely.

Thank you!