Skip to content

Commit

Permalink
fix: call OnStartClient only once in room (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpach committed Dec 1, 2019
1 parent 2195fee commit 4d373c5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Assets/Mirror/Runtime/NetworkIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,13 @@ internal void OnStartServer()
}
}

bool clientStarted;
internal void OnStartClient()
{
if (clientStarted)
return;
clientStarted = true;

if (LogFilter.Debug) Debug.Log("OnStartClient " + gameObject + " netId:" + netId);
foreach (NetworkBehaviour comp in NetworkBehaviours)
{
Expand Down Expand Up @@ -1114,6 +1119,7 @@ internal void Reset()
if (!m_Reset)
return;

clientStarted = false;
m_Reset = false;

netId = 0;
Expand Down

0 comments on commit 4d373c5

Please sign in to comment.