Hello, one of my scenes behaves very differently in the editor than when compiled. It doesn’t mater if I build for android or for windows, it behaves differently. I would like to be bale to read the Debug.Log() output from the compiled version, like I can when running in the editor. However, I don’t know how to tell the compiled version that it should create a log file with runtime logging. Does anyone know how to do this?
This is the magic sauce you seek:
https://docs.unity3d.com/ScriptReference/Application-logMessageReceived.html
That and some good old System.IO writing and you should be golden.
Why not just write the Debug.Log output to a text element on the screen during development? That’s what I do on the Sample IAP project Sample IAP Project
I recently came across this (which is more than worth the asking price)…
It includes a rich runtime console, amongst other tools. Very useful for testing builds on-device.
Just make sure that that debug logging (and SRDebugger) is disabled for the final release build (using a compiler directive)
Thanks for all the suggestions. All of the above will definitely solve the need.
however, I was sure there would be some “development build” toggle somewhere, that would just out of the box enable the compiled version to write logs to a file without needing to implement anything. I know now that that’s not the case unfortunately ![]()
Hi @rpuls ,
On Windows, Android & iOS (development or release) builds, logging will always be written (unless you choose to disable it via compiler directives, for example)
It’s the viewing of the logs that’s the issue, not helped by the fact that each platform handles the resulting log files differently.
So building your own simple viewing UI (using the event @Kurt-Dekker outlined above) or buying one from the asset store, solves the issue.
I hope this helps.
Good luck ![]()
They already are written to a file. You can use adb logcat to the read the files on Android. And on Windows, they are written to the file system. Debug.Log statements are written to the log https://discussions.unity.com/t/699654