mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Minor updates to AdditiveScenes example
This commit is contained in:
parent
1f1d13ed42
commit
3afd54e182
@ -25,6 +25,16 @@ public override void OnStartServer()
|
||||
Instantiate(Zone);
|
||||
}
|
||||
|
||||
public override void OnStopServer()
|
||||
{
|
||||
StartCoroutine(UnloadScenes());
|
||||
}
|
||||
|
||||
public override void OnStopClient()
|
||||
{
|
||||
StartCoroutine(UnloadScenes());
|
||||
}
|
||||
|
||||
IEnumerator LoadSubScenes()
|
||||
{
|
||||
Debug.Log("Loading Scenes");
|
||||
@ -36,16 +46,6 @@ IEnumerator LoadSubScenes()
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStopServer()
|
||||
{
|
||||
StartCoroutine(UnloadScenes());
|
||||
}
|
||||
|
||||
public override void OnStopClient()
|
||||
{
|
||||
StartCoroutine(UnloadScenes());
|
||||
}
|
||||
|
||||
IEnumerator UnloadScenes()
|
||||
{
|
||||
Debug.Log("Unloading Subscenes");
|
||||
|
@ -14,22 +14,20 @@ public class ZoneHandler : MonoBehaviour
|
||||
[Tooltip("Assign the sub-scene to load for this zone")]
|
||||
public string subScene;
|
||||
|
||||
[ServerCallback]
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (!NetworkServer.active) return;
|
||||
|
||||
// Debug.LogFormat(LogType.Log, "Loading {0}", subScene);
|
||||
// Debug.Log($"Loading {subScene}");
|
||||
|
||||
NetworkIdentity networkIdentity = other.gameObject.GetComponent<NetworkIdentity>();
|
||||
SceneMessage message = new SceneMessage{ sceneName = subScene, sceneOperation = SceneOperation.LoadAdditive };
|
||||
networkIdentity.connectionToClient.Send(message);
|
||||
}
|
||||
|
||||
[ServerCallback]
|
||||
void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (!NetworkServer.active) return;
|
||||
|
||||
// Debug.LogFormat(LogType.Log, "Unloading {0}", subScene);
|
||||
// Debug.Log($"Unloading {subScene}");
|
||||
|
||||
NetworkIdentity networkIdentity = other.gameObject.GetComponent<NetworkIdentity>();
|
||||
SceneMessage message = new SceneMessage{ sceneName = subScene, sceneOperation = SceneOperation.UnloadAdditive };
|
||||
|
Loading…
Reference in New Issue
Block a user