Debug compiled code

Hi,
Is there any way to find out what’s causing NullReferenceException from log on build.
I mean can I somehow decode this error, without editing the source code, by adding lot of Debug.Logs or if(something == null) etc.
Example from log :

NullReferenceException: Object reference not set to an instance of an object
at “somescript”.Start () [0x000ca] in <3be48ce5f03b4533aa77cd728cbd94f0>:0

can I find what line of code is it? [0x000ca] etc.to find problematic variable?
Sorry if it was asked before, but I couldn’t find the answer

Check the log files.

But this is from log file :smile:

Oh, thought it was from the stack trace / error message popup.

You can enable additional messages and debug options in the build settings to get something more verbose.

1 Like

Unity’s IL2CPP strips all kinds of useful debugging info out, but sometimes you can still get the gist of where things are going wrong in the build by studying the stacktrace, even if it doesn’t tell you the line number of the crash.

Beyond that it’s really gonna be up to adding enough Debug.Log() calls to isolate where things are going south.

1 Like

Thank you for your time and answers, seems like Debug.Log() each step is the best way, I had little hope that I can decode these magic numbers

Is the build for windows? You can just attach the Visual Studio debugger to your game exe, for other plattforms it’s also possible but more complicated.

1 Like