void Start() { if (MultiplayerManager.instance.m_isServer) { InvokeRepeating("ServerSendCarPositions", 0, 1 / (float)SEND_RATE); } else { var vehicleParent = new GameObject("Vehicles Network parent"); for (int i = 0; i < CAR_POOL_SIZE; i++) { var obj = new GameObject("CarPoolObject " + i); obj.transform.parent = obj.transform; obj.AddComponent <VehicleNetworkView>(); obj.AddComponent <MeshFilter>(); obj.AddComponent <MeshRenderer>(); obj.SetActive(false); NetworkCarObject nCarObject = new NetworkCarObject(); nCarObject.GameObject = obj; m_fakeCarsPoolAvailable.Add(nCarObject); } } }
void Start() { if (MultiplayerManager.instance.m_isServer) { InvokeRepeating("ServerSendCarPositions", 0, 1 / (float)SEND_RATE); } else { var vehicleParent = new GameObject("Vehicles Network parent"); for (int i = 0; i < CAR_POOL_SIZE; i++) { var obj = new GameObject("CarPoolObject " + i); obj.transform.parent = obj.transform; obj.AddComponent<VehicleNetworkView>(); obj.AddComponent<MeshFilter>(); obj.AddComponent<MeshRenderer>(); obj.SetActive(false); NetworkCarObject nCarObject = new NetworkCarObject(); nCarObject.GameObject = obj; m_fakeCarsPoolAvailable.Add(nCarObject); } } }