Search Unity

PlayerPrefab to multiple scenes

Discussion in 'Multiplayer' started by kdarius43, Sep 25, 2017.

  1. kdarius43

    kdarius43

    Joined:
    Mar 16, 2015
    Posts:
    170
    Hello all,
    I have a very simple game which uses only two computer. I am using unity's Network Manager. I had everything working just fine. I would start the server on one computer and started the client on another. They both played there respective scenes and passed the relevant info back and forth. Now what I wanted to do was while the game is not being played have both the client and server playing a opening scene. So I created the scenes loaded them up my player prefab which i called NetworkScripts (because its not really a player) was spawned the the scenes changed. The issue when the new scene was open NetworkScripts (aka the player prefab) was destroyed. I then tried putting a do not destroy script on it and it was still destroyed... is there anyway I can have the player prefab live through the scenes?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If I'm not mistaken, it is the Network Manager that destroys it, and you can create a custom Network Manager that can override that behavior. There's other threads on the specifics here you can search for.
     
  3. kdarius43

    kdarius43

    Joined:
    Mar 16, 2015
    Posts:
    170
    the first mistake was suning Scenemanager to change scene. I changed it to
    Code (CSharp):
    1.        
    2.  NetworkManager.singleton.ServerChangeScene ("FlickFootballServer");
    The issue is I want a different scene playing sever and the client and this is change the scene in both the sever and client.