mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
syntax
This commit is contained in:
parent
398824703d
commit
53b54f3dac
@ -46,10 +46,10 @@ void Update()
|
||||
// if scene changed:
|
||||
// add previous to dirty
|
||||
// add new to dirty
|
||||
foreach (NetworkIdentity netIdentity in NetworkIdentity.spawned.Values)
|
||||
foreach (NetworkIdentity identity in NetworkIdentity.spawned.Values)
|
||||
{
|
||||
Scene currentScene = lastObjectScene[netIdentity];
|
||||
Scene newScene = netIdentity.gameObject.scene;
|
||||
Scene currentScene = lastObjectScene[identity];
|
||||
Scene newScene = identity.gameObject.scene;
|
||||
if (newScene == currentScene) continue;
|
||||
|
||||
// Mark new/old scenes as dirty so they get rebuilt
|
||||
@ -60,17 +60,17 @@ void Update()
|
||||
// and the new scene need to rebuild their respective observers lists.
|
||||
|
||||
// Remove this object from the hashset of the scene it just left
|
||||
sceneObjects[currentScene].Remove(netIdentity);
|
||||
sceneObjects[currentScene].Remove(identity);
|
||||
|
||||
// Set this to the new scene this object just entered
|
||||
lastObjectScene[netIdentity] = newScene;
|
||||
lastObjectScene[identity] = newScene;
|
||||
|
||||
// Make sure this new scene is in the dictionary
|
||||
if (!sceneObjects.ContainsKey(newScene))
|
||||
sceneObjects.Add(newScene, new HashSet<NetworkIdentity>());
|
||||
|
||||
// Add this object to the hashset of the new scene
|
||||
sceneObjects[newScene].Add(netIdentity);
|
||||
sceneObjects[newScene].Add(identity);
|
||||
}
|
||||
|
||||
// rebuild all dirty scenes
|
||||
|
Loading…
Reference in New Issue
Block a user