Skip to content

Commit d164192

Browse files
committed
refactored GetPlayerId to use AuthService's playerId when signed in on IP connections as well
1 parent f479872 commit d164192

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Assets/BossRoom/Scripts/Shared/Net/ConnectionManagement/GameNetPortal.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,24 @@ public void RequestDisconnect()
253253

254254
public string GetPlayerId()
255255
{
256-
if (OnlineMode == OnlineMode.IpHost)
256+
var playerId = "";
257+
if (AuthenticationService.Instance.IsSignedIn)
257258
{
258-
return ClientPrefs.GetGuid() + ProfileManager.Profile;
259+
playerId = AuthenticationService.Instance.PlayerId;
259260
}
260-
if (OnlineMode == OnlineMode.UnityRelay)
261+
else if (OnlineMode == OnlineMode.IpHost)
261262
{
262-
return AuthenticationService.Instance.PlayerId;
263+
playerId = ClientPrefs.GetGuid() + ProfileManager.Profile;
263264
}
264-
Debug.LogError($"OnlineMode not set to a valid value: {OnlineMode}");
265-
return "";
265+
else if (OnlineMode == OnlineMode.UnityRelay)
266+
{
267+
Debug.LogError("OnlineMode set to UnityRelay, but not signed in through AuthenticationService.");
268+
}
269+
else
270+
{
271+
Debug.LogError($"OnlineMode not set to a valid value: {OnlineMode}");
272+
}
273+
return playerId;
266274
}
267275
}
268276
}

0 commit comments

Comments
 (0)