- Home /
How to debug code (JavaScript)
Is there something in Unity for stopping the code while it is executing in some pre-determined points and then verify the value of whatever variables at that time and then keep on moving? Something like what VBA for Excel has.
I ask this because I want to do something in the Update() function, but it doesnt do what I want, but when I try to see what is going on, the Update function doesnt stop, all I can get is whatever I put in the log.
Is not any way of stopping it (other than the stop or pause button) and check what the current values are?
Answer by duck · Mar 10, 2010 at 08:10 AM
As well as using Debug.Break() to pause the editor, you can also switch the Inspector pane to "Debug Mode" which shows up all the variable values for the selected object, including private vars, so you can examine their values.
To switch the Inspector pane to Debug mode, look for the small dropdown menu icon to the left of the "Inspector" tab, at the very top of the pane.
The Inspector has a Debug mode, and shows private variables? Excellent! Here, have a +1. (And because you need more points - I hear at 10$$anonymous$$, you get a free toaster-oven. :)
A toaster-oven? I thought it was a luxury cruise! All that effort, wasted!
Answer by Eric5h5 · Mar 10, 2010 at 06:53 AM
Use Debug.Break(), which pauses the editor. Or, if you have "Error pause" selected in the console, you can use Debug.LogError(), which will also pause the editor.
Your answer
Follow this Question
Related Questions
Not getting a Debug.Log 2 Answers
Monster Spawner 3 Answers
Assign Default For Large Array 1 Answer
if statement or just setting transform.position? 1 Answer
How can i make the ray cast don't go through the walls 1 Answer