Hello all I was wondering if anyone has any ideas why I have with players and the map when they join the LAN game. So if the host starts the game and changes the map by clicking on some blocks and destroying them (like a cube game) then someone joins the game (client) they don’t see the changes made to the map. However all future changes once they join are seen just fine. I even tested where server starts the game and does nothing then the client joins before any changes are made there is a perfect sync. So why does this happen? Does anyone got any ideas to this? I would really appreciate everyones help and advice. Here is the network code with what makes the cube map.
using UnityEngine;
using System.Collections;
public class NetworkManager : MonoBehaviour
{
public GameObject playerPrefab;
public GameObject snow;
public Transform spawnObject;
private bool done = false;
void OnGUI()
{
if(!Network.isClient && !Network.isServer)
{
if (GUI.Button(new Rect(Screen.width/2,Screen.height/2,100,20),"Start Server"))
{
startServer();
}
if (GUI.Button(new Rect(Screen.width/2,Screen.height/2 + 60,100,20),"Connect"))
{
Network.Connect("###.###.#.#", 25000);
}
}
}
void Awake()
{
Network.minimumAllocatableViewIDs = 20000;
}
void Update()
{
}
void startServer()
{
Network.InitializeServer(32,25000, !Network.HavePublicAddress());
if(Network.isServer)
{
for (int x = 0; x < 28; x++)
{
for (int y = 0; y > -2; y--)
{
for(int z = 0; z < 28; z++)
{
GameObject ChuckSpike = Network.Instantiate(snow, new Vector3(x, y, z), Quaternion.identity,0) as GameObject;
ChuckSpike.transform.tag = "chunk0";
}
}
}
}
}
void OnServerInitialized()
{
Debug.Log("server initialized");
spawnPlayer();
}
void OnConnectedToServer()
{
spawnPlayer();
}
void spawnPlayer()
{
Network.Instantiate(playerPrefab, spawnObject.position, Quaternion.identity, 0);
}
}