Are comments stripped out at runtime?
Any code that we comment out with /* */ or // ?
Are comments stripped out at runtime?
Any code that we comment out with /* */ or // ?
I’m not sure what exactly you’re asking. If you comment anything out in the standard methods - // and /* */ like you mentioned - it won’t run, no.
Sure, I know that… but are these comments stripped out by the compiler?
Most compilers strip out comments at compile time… I want to make sure Unity does this too.
There’s an option to strip “debug symbols” in the build preferences, is that what you mean?
Yes… but I just wanted confirmation that it includes comments. I’m sure it does… just looking to be re-assured.
When Unity compiles your source code, the comments are stripped out and not at all present in the final bytecode. Things like function names, variable names and constants are still there, according my tests using free online .NET decompilers. The decompilers do not handle coroutines very well, otherwise you can get nearly back to your original source code, minus the comments. (Sometimes it’s formatted better, too, as you lose your original formatting. )
But no comments.
-Jon
Stripping debug symbols only affects the symbols in the actual Unity Player binary and associated libraries, as far as I know. All that is your project is contained in the data which the generic Unity Player reads.
-Jon
Awesome… thanks Jonathan
Can you recommend any of these decompilers? Some urls would be great.
Cheers.