Godot version: e2b7a68db450d0d48d005719731619a49f96b7c8
OS/device including version: Win10 x64
Issue description:
Exporting a mono-based game requires you to include the cs files in the exported pck file, otherwise the engine fails to load said scripts despite the compiled assembly being present in the pck. This is especially an issue for closed-source/commercial games which probably don't want to ship the source to their game in the pck.
I'm guessing that fixing this will require #15661 unfortunately.
Random thought on this - does the engine actually read anything from cs
files at runtime? If not, a (hacky) fix would be to have only empty cs files exported into the pck file.
It's trivially easy to decompile very readable C# from the DLLs.
Pragmatically it's probably realistic to consider the source published, FOSS or proprietary, once your product is released.
Edit: Sorry, I didn't mean for this to come across as against the suggestion. I think that removing the raw source is a good idea, but I don't think it will stop the curious from looking under the hood.
I have to absolutely disagree. Decompiling C# may give you something semi-readable, but it will be missing variable names and comments, and will have all kinds of weird code due to compiler optimizations. It is a far cry from outright shipping your code with the game.
There is no reason we should have to ship the code itself with a game.
It exports empty source files. There is an option to export the source code, which is disabled by default.
I can't check now (will do so in a few hours), but that seems incorrect from my experience. At the very least, it seems like the option is on by default. Or maybe my project settings are screwed up.
@redxdev Oops, you're actually right. I forgot to change it:
Most helpful comment
@redxdev Oops, you're actually right. I forgot to change it:
https://github.com/godotengine/godot/blob/02372bfdf7e81bb3e1a154f824665fc9ddbcd566/modules/mono/csharp_script.cpp#L124