- Home /
Unity Editor Completely Freezing on Server Start
I can use the menu in my game to get through my server creation window, but as soon as I hit the "Start Server" button my whole editor freezes, and I have to kill it using the task manager. Because the editor completely locks up, I can't really use Debug.Logs to find where it is crashing. It worked ok before, so I'm just going to put my OnServerInitialized (which is what I changed) and what it calls in the first object.
I have structured it so that the OnServerInitialized method in my game runner object calls a method inside my Vehicle object, ActivateInput, using a BroadcastMessage. The ActivateInput method starts off my InputCoroutine in that object.
If you need to see any more code please just ask. And help would be much appreciated, I've been scratching my head on this one for a few hours now.
public void OnServerInitialized(){
for(int i = 0; i < playerObjects.Length; i ++)
{
playerObjects[i].networkView.viewID = Network.AllocateViewID();
playerObjects[i].transform.position = offsides.position+i*Vector3.right;
}
playerObjects[0].transform.position = arenaSpawn.position;
playerObjects[0].transform.rotation = arenaSpawn.rotation;
camera.targetObject = playerObjects[0].transform;
playerObjects[0].gameObject.GetComponent<Vehicle>().BroadcastMessage("ActivateInput", playerObjects[0] as NetPlayer);
}
public void ActivateInput(NetPlayer player)
{
Debug.Log("Started input co");
this.player = player;
StartCoroutine("InputCoroutine");
}
Answer by Slobdell · Aug 11, 2013 at 07:38 AM
This usually happens when you're in an infinite loop. How many player objects are there?
At the time of that code, it was 4. I've changed it so now it only creates player objects as players join, but the same problem still happens. $$anonymous$$y first thought was an infinite loop too, but I have no idea where it might be.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
c# Using an IEnumerator yield WaitForSeconds to temporarily pause a While loop 3 Answers
What is way to flash the screen WITHOUT using a Texture? 2 Answers
"Strange behaviour may occur" when using Network.AllocateViewID() 0 Answers
UDP implementation in Unity, unable to send to two different machines 0 Answers