Hi folks, quick question here to some of the more experienced programmers out there.
Myself, I am just a newbie, and I have noticed that my code is often quite cluttered with commented Debug.Log() lines that I used during the writing of the script, and then commented when finished, but left in the code in case I would like to debug this again at a later time (which I often do).
I’m just curious to know what professionals do in this case. Do they remove the debug lines entirely once a class is deemed “working as intended”, or something else?
I have a singleton global helper script that stays constant across the application. In the script, there is a boolean to tick/check to enable debugging at any time. Then where I wrap an if around IsDebuggingEnabled boolean to print out the debug info. I’ve found that depending on the amount of debugging stuff being thrown to logs there can be a performance hit when running on a mobile device. So this method gets me debugging when necessary, and allows me to disable all when i publish without finding and uncommenting all.
I thought I read on the forums here somewhere that Debug.Log would create performance issue and should be commented out or deleted for production… but i been wrong before
I know I’ve dug console logs out of the device before, and Debug.Log’s definitely show up there, with all their stacktraces included. So the default setting on that (I can’t find it in my Player settings, either) is clearly the one that’s going to be super slow.