unity commandline execution debugging

If I run something from the commandline, do Debug.Logs get output to a file? If so, where is the file? (I don't see it in with the webplayer log files, for instance).

To debug built versions of your game (whether they're running in Batch Mode or not), you need to continue to use Debug.Log messages in your code, just like you would in the Editor, however you need to find the log file generated by your build. These are separate files to the one that the editor generates when playing your project in the editor.

The location and filename for logs from your built version depends on which platform you're running on (mac/windows), and what kind of build it is (web/standalone). The location does not change if run in Batch Mode.

For webplayer builds, the log files can be found here:

  • OS X:

    /Users/<USERNAME>/Library/Logs/Unity/WebPlayer.log

  • Windows XP: `C:\Documents and Settings\\Local Settings emp\UnityWebPlayer\log`

  • Vista/Windows 7

    C:\Users\<USERNAME>\AppData\Local\Temp\Low\UnityWebPlayer\log

For Windows EXE builds, the log file is located in the 'Data' folder that accompanies your build, and is named "output_log.txt".

For Mac stand-alone builds, it seems all builds write to the same location mentioned above (`/Users//Library/Logs/Unity`), but under the filename "Player.log" instead of "WebPlayer.log".

It's useful to open these log files with a program which detects incremental changes to the file and either informs you that the file has changed (such as Notepad++ for windows), or even better, "tails" the file to show the newly added lines (tail for Mac, and BareTail for Win both do this) so that you get a scrolling pane of text showing changes to the log file as they happen.

Note: this post is incorrect. Please disregard it.


Any Debug calls are removed during compile-time. Debug statements are only for use in Unity Editor while creating your game.

.NET has various file operation classes. You could very easily write your own debug class that could output to a file, and use that instead. Writing your own would work no matter what, even if you compiled and ran your game outside of Unity.