I outsourced some heavy calculations into another thread like mentioned in this post.
After searching for an hour why the calculation did not work I found my mistake - I tried to access an array index which was out of bounds, but the console doesn’t show up this runtime error.
Is this the default behaviour of unity only printing errors from the main thread?
How can I see/print errors which occur in another thread?
Exceptions on worker threads must be sent to Unity for printing manually. Put your code inside try{} block and print catch using Debug.LogException:
Thread thread = new Thread(
()=> {
try {
/*
Your code goes here
*/
} catch (System.Exception ex) {
Debug.LogException(ex);
}
}
);
Yes this is normal behavior. Create a delegate to use Debug.Log(or whatever) from the main thread.