Hi there.
Please have a look at the following script:
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
Debug.Log("First Thread:" + Thread.CurrentThread.ManagedThreadId.ToString());
Thread newThread = new Thread(RunThread1);
newThread.Start();
}
public void RunThread1()
{
Debug.Log("Second Thread: " + Thread.CurrentThread.ManagedThreadId.ToString());
}
}
When I attach it to a gameobject and press play in UnityEditor. I get the following output as expected:
- First Thread: 1
- Second Thread: 2
If I stop playmode and enter playmode again, I get the following output:
- First Thread: 1
- Second Thread: 1
So it seems, that in Unity Editor, only the first time I enter the playmode a new thread is created?
On my machine this happens all the time (at least for all tests I could made).
Am I missing something or is this a bug?
I’m using unity 3.5.1 on Windows7 64bit.
Thanks for any help.