- Home /
Strange Debug.Break() behavior
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?
Answer by eedok · Oct 24, 2012 at 07:29 AM
Debug.Break() pauses at the end of frame, not the point in code you put it
Answer by Venryx · Oct 15, 2016 at 06:28 AM
There is a way to completely break/pause-execution at a single line.
See my answer here: http://answers.unity3d.com/answers/1242264/view.html
Your answer
Follow this Question
Related Questions
Using FindGameObjectsWithTag to print text 1 Answer
Render text on sprite prefab - 2D iOS 4 Answers
Need Help With Unity iOS "touch" Code 2 Answers
Need Help Calling A Trigger Function 1 Answer
Zooming in and out on iPhone 1 Answer