How to Debug in a standalone build?

I’m testing out some recoil effect for a shooter game. And it works perfectly in the editor. But when I create a build, the build doesnt do the effect. So I was wondering… Is there any way to make a build with a debugging console? Or something similar?

-thanks :slight_smile:

EDIT: thanks for all the answers, but most of these are only alternate ways to display the Debug.Log(“”); function. I need to see if there will be any compiler errors or nullrefferenceexceptions. Thanks for the answers though :slight_smile:

actioscripter's answer (and now mine too) do refer to the only alternative you can use to debug unhanded crashes: log files.

Check this plugin: https://www.assetstore.unity3d.com/en/#!/content/44935

4 Answers

4

There isn’t an easy way to get a console for a build, but you can check the log file after you run it. The file will be in the data folder that comes with the build. It should list any errors encountered during runtime.

provided you have access to the system files, that is indeed an option.

I can't think of a case where it's not possible to access the log file... it's one level below the executable, in the data folder's top level.

if your app is sandboxed for any reason and out of your reach. when you deliver a product to iPad, for instance.

check this tool

This seems to be much better than DebugConsole! I wonder how it was done.

this tool view the logs which appears on editor console no need to make extra log + it show exceptions and unexpected error without loging it exactly same what editor console does

Thanks man. I know this question is old, but this works awesomely! Accepting this as an answer :)

Something similar. unifycommunity.com

In other words, you sure can write your own DebugConsole which show up things at your own way. The only downside is you won’t be able to double click the line at Unity’s Console and get linked back to it in the source code.

Following the question edit, you want then to see the Log Files. It will depend on your platform, please refer to the docs. They’re currently at: Unity - Manual: Log files

But you still can use try & catch or simple error prevention and something like the DebugConsole. Maybe sending e-mails or a SOAP to your server reporting errors. It’s much more recommended.

the first link is dead

There´s an easy way too… Just download DbgView (http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx) and use OutputDebugString() to write to it.

C# Example:

using UnityEngine; 
using System.Collections;
using System.Runtime.InteropServices;

public class Debug : MonoBehaviour 
{
    [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
    public static extern void OutputDebugString(string message);

    void Start() 
    {
        OutputDebugString("started...");
    }
}

I'd stick with the simpler (and smaller) DebugConsole. :P

With this. Can you see compiler errors?

DbgView works, and shows all the Unity messages (internal and Debug.Log). However, it's pretty spammy since Unity includes stack information on every message. 1) is it possible yet to disable stack information on some or all Debug.Log calls? 2) how can I see these messages in the Visual Studio Output Window instead of having to run DbgView?