So, my network game works fine for a while then for some strage reason the server gets stuck(clicking on it says the game is not responding). If i disconnect the client the server loads the main menu fine and works ok again.
Here is the spawn code for the crate:
using UnityEngine;
using System.Collections;
public class CrateSpawner : MonoBehaviour {
public float spawnTimer = 10.0f;
public void SpawnCrates()
{
if (Network.isServer)
{
Network.Instantiate (Resources.Load ("Prefabs/crate2"), this.transform.localPosition, this.transform.rotation, 0);
}
}
void Update () {
if (spawnTimer <= 0) {
SpawnCrates();
spawnTimer = 60.0f;
}
else {
spawnTimer -= Time.deltaTime;
}
}
}