Why does unity editor hang when play button is pressed.

I am having a problem. Whenever I press the play button on the Unity Editor It freezes my whole program. I have to go to the Windows Task Manager and End Task it. Does anyone know why that happens and how to fix it?

Also I am running windows 7 64 bit edition if that will help.

This was a pure accident but I have found what hangs my Unity Editor. It hangs when my player settings are set to Android. When it hung I turned on my task manager to end task it but the tab was processes. I noticed that I had like 20 adb.exe running (one for each time it hung). I started deleting them and like magic the play button works.

So my answer is (only for ANDROID so far) If your unity editor hangs, check your task manager and delete all your adb.exe this should allow it to continue to function.

You probably coded an infinite loop somewhere that runs at start…

Try disabling your scripts to see which one is the faulty one and then add it to your question by press edit.

I had the same issue. Mine was cause by the NavMesh. I cleared the baked NavMesh and all was fine. My thoughts are that there was too much data.

An FYI, I was able to debug this by using the Profiler (Unity Pro Only I believe).

Hope that helps.

It is possible that it has nothing with your computer. Check if you haven’t some exceptions, objects have references to scripts, etc. I had the same problem.

using UnityEngine;
using System.Collections;

public class Scroller : MonoBehaviour {

public int maxPlatform = 20;
public GameObject platForm;
public float horizontalMax=14f;
public float horizontalMin=6.5f;
public float verticalMax=6f;
public float verticalMin=-6f;
private Vector2 originPosition;

// Use this for initialization
void Start () 
{
    originPosition = transform.position;
    spawn();
}

// Update is called once per frame
void Update ()
{

}

void spawn()
{
    
    for (int i = 0; i < maxPlatform; i++)
    {
        Vector2  randomPosition=originPosition+ new Vector2 (Random.Range(horizontalMin,horizontalMax),Random.Range(verticalMin,verticalMax));
        Instantiate(platForm, randomPosition, Quaternion.identity);
        originPosition = randomPosition;
    }
}

}