Unity3D is nothing but a powerful Cross Platform IDE which provides flexible development environment. It is easy for the beginner and is also powerful for an expert. Mostly programmers who love to build Applications or 3D Games for Mobile Devices, Websites, Desktop etc take interest in Unity3D IDE. Unity3D is one of the most popular IDE for Game Development
Debugging is the most important thing to be done while making any Application or Game. Debugging helps programmer to check the status of a bunch of variables at a certain point of time in any application. In simple words, Debugging helps you to find the root cause of the bug or error you are facing.
Debugging can be done manually by Coders or by using IDE's. Many IDE's provide inbuilt Debugging feature in it which reduces the manual debugging effort of the coder. Unity3D is one such IDE which provides the inbuilt Debugging feature. But many programmers or coders don't know how to use this feature. For example,
When you debug this code, the log message will look like this -
Above is the basic example, but it is sure that if you are in programming with Unity for a long time, we will have to use Debug Log to output at some point of time. So how to use the debugging feature in Unity3D?
For Debugging, click on the left edge of the line you want to debug in the editor(for example, if you want to debug your code on 7th line click the left edge of the editor besides 7th line), as soon as you click it, a red dot will appear there indicating that the debugging breakpoint is created.
Now to start using the Debugger, all we need to do is just press the Play button on the top of Mono Develop window:
Once we press the Play button, Mono Develop will prompt us "Attach to a process". After that you have to select the instance of unity and press Attach.
For Now, it will not do anything, but if we go to Unity and press Play button in the editor window then something will happen...
Now, at the bottom of the window panel, there will be an option like "Locals", just click it (if you don't find "Locals" at the bottow of the window panel ,go to View->Debug Windows->Locals), you will see, every variables that are there in your code and their values at that the point of time.
To continue the application execution, press Play button in Mono Develop.
To stop Debugging, just press the "Stop" button on the top of Mono Develop window.