Skip to content

Commit

Permalink
fix: checking for custom visibility in new assert
Browse files Browse the repository at this point in the history
custom visibility is allowed to bypass the OnlySpawnOnAuthenticated check
  • Loading branch information
James-Frowen committed Oct 8, 2022
1 parent 629fab8 commit f4b9597
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Assets/Mirage/Runtime/ServerObjectManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,8 @@ public void Spawn(NetworkIdentity identity, INetworkPlayer owner)

internal void SendSpawnMessage(NetworkIdentity identity, INetworkPlayer player)
{
logger.Assert(!OnlySpawnOnAuthenticated || player.IsAuthenticated, "SendSpawnMessage should only be called if OnlySpanwOnAuthenticated is false or player is authenticated");
logger.Assert(!OnlySpawnOnAuthenticated || player.IsAuthenticated || identity.Visibility != null,
"SendSpawnMessage should only be called if OnlySpanwOnAuthenticated is false, player is authenticated, or there is custom visibility");
if (logger.LogEnabled()) logger.Log($"Server SendSpawnMessage: name={identity.name} sceneId={identity.SceneId:X} netId={identity.NetId}");

// one writer for owner, one for observers
Expand Down

0 comments on commit f4b9597

Please sign in to comment.