This is my script attached to an object:
function OnCollisionEnter(collision : Collision) {
if (collision.gameObject.tag != "Trigger") {
Debug.Break();
Destroy(rigidbody);
Destroy(collider);
// etc etc
while (true) {
if (!audio.isPlaying) break;
yield;
}
// etc etc
Debug.Log("Reached end of script");
Destroy(gameObject);
}
}
The script runs through to it’s end, with each print appearing in the console, however the Debug.Break(); does not cause the editor to pause, it only pauses after Destroy(gameObject); is performed.
Any ideas?