Skip to content

Commit

Permalink
fix: third try to prevent double load (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
uweeby committed Oct 30, 2020
1 parent d90656b commit 347d176
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Assets/Mirror/Runtime/NetworkSceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,7 @@ internal void ClientSceneMessage(INetworkConnection conn, SceneMessage msg)
// Let client prepare for scene change
OnClientChangeScene(msg.scenePath, msg.sceneOperation);

//if host mode and scene change is additive
if (client.IsLocalClient && msg.sceneOperation != SceneOperation.Normal)
{
FinishLoadScene(msg.scenePath, msg.sceneOperation);
}
else
{
StartCoroutine(ApplySceneOperation(msg.scenePath, msg.sceneOperation));
}
StartCoroutine(ApplySceneOperation(msg.scenePath, msg.sceneOperation));
}

internal void ClientSceneReadyMessage(INetworkConnection conn, SceneReadyMessage msg)
Expand Down Expand Up @@ -213,7 +205,8 @@ public void ChangeServerScene(string scenePath, SceneOperation sceneOperation =
// Let server prepare for scene change
OnServerChangeScene(scenePath, sceneOperation);

StartCoroutine(ApplySceneOperation(scenePath, sceneOperation));
if(!client.IsLocalClient)
StartCoroutine(ApplySceneOperation(scenePath, sceneOperation));

// notify all clients about the new scene
server.SendToAll(new SceneMessage { scenePath = scenePath, sceneOperation = sceneOperation });
Expand Down

0 comments on commit 347d176

Please sign in to comment.