Search Unity

UNET multi scene

Discussion in 'UNet' started by MadanyNO, May 8, 2018.

  1. MadanyNO

    MadanyNO

    Joined:
    Apr 18, 2016
    Posts:
    16
    hi all,
    i was building a game, where i have a scene that is loaded first with a scrip to load other scene additivly,
    which worked well. but then when i tried to implment the same thing in to the network, it loads for my server,
    but not for clint that get conected to the server.
    i mean it does load my player and the scene i set as the online scene for the clints, but it does not load all
    the other additve scenes i load on the server.

    to be more clear:
    i set on my network manger a scene, that have a script on her that load more scene additvly.
    the script work fine for my server, but when a new clint get conected, only the online scene get loaded,
    but not the other additve scenes.
    that cause for all the things those scene load to not been load to the clint.

    here is the code i used to load the scene i want to add

    Code (CSharp):
    1. public class NetUnityDataHolder : NetworkBehaviour
    2.     {
    3.         public Dictionary<string, MapData> MapList;
    4.         public Dictionary<string, NetUnityMapControl> SceneList;
    5.  
    6.         // Use this for initialization
    7.         void Awake()
    8.         {
    9.          //load the list of maps and there info
    10.             MapList = GameInfo.LoadDic<MapData>(GameInfo.MList);
    11.             SceneList = new Dictionary<string, NetUnityMapControl>();
    12.  
    13.             SceneLoades();
    14.  
    15.         }
    16.  
    17.  
    18.         public void SceneLoades()
    19.         {
    20.             foreach (MapData map in MapList.Values)
    21.             {
    22.                 SceneManager.LoadScene(map.Name, LoadSceneMode.Additive);
    23.                 GameObject a;
    24.                 string path = "MapControl";
    25.                 a = Instantiate(Resources.Load(path), new Vector3(), new Quaternion()) as GameObject;
    26.                 SceneManager.MoveGameObjectToScene(a, SceneManager.GetSceneByName(map.Name));
    27.                 SceneList.Add(map.Name, a.GetComponent<NetUnityMapControl>());
    28.                 SceneList[map.Name].GetSceneData(map.Name);
    29.             }
    30.         }
    if anyone has an idea or a way to load scene additvly to the online scene it can really help