- Home /
 
 
               Question by 
               LennyParisi · Nov 06, 2016 at 09:29 AM · 
                networkingnetworksynchronizationnetworkviewlevels  
              
 
              How to load all character previously in game when new player joins
Hey guys, I'm trying to make a small multiplayer tank game for testing purposes and have encountered a problem...Whenever I join my game with a second player, the first player is not loaded into the second player's game (but the second player does load into the first player's game). What should I do?
Here's my code if you need it:
 public class GameManager : MonoBehaviour
 {
     //player object to instantiate
     public GameObject playerPrefab;
 
     void Start()
     {
     //Spawns a player on start (when player joins scene)
             SpawnPlayer();
     }
 
     //spawn player
     private void SpawnPlayer()
     {
     //Finds a spawn point and instantiates a player at its location
         GameObject spawnPoints = GameObject.Find("Spawns");
         Network.Instantiate(playerPrefab, spawnPoints.transform.GetChild(Random.Range(0, spawnPoints.transform.childCount - 1)).transform.position, Quaternion.identity, 0);
 
     }
     
 }
 
               I know that this is issue is caused by not creating a second player anywhere, but I'm not sure what to do. If I create a second player from this client, the player will control two at a time (because the movement script checks to see if 'networkView.isMine' and since they'll both be the same client's....
Please let me know, thanks!
               Comment
              
 
               
              Your answer