/// <summary> /// Called on the client when ever the scene changes. /// /// todo: Don't handle player spawning in here. We currently do it here because we want to spawn /// a player object as soon as we change to the online scene. However further down the road we /// will have more than just one scene and will eventually run into problems where this function /// is called for every scene. Which we don't want potentially. Rather we will not be unloading /// spawned player objects on scene changes. /// </summary> /// <param name="conn"></param> public override void OnClientSceneChanged(NetworkConnection conn) { base.OnClientSceneChanged(conn); Debug.Log("OnClientSceneChanged"); // spawn our player var msg = new AddPlayerMessage(); msg.playerPrefabIndex = networkPrefabIndex; msg.name = localPlayerName; ClientScene.AddPlayer(conn, 0, msg); }