dimanche 2 juillet 2017

Is it a good idea to compile procedural code into a DLL myself instead of saving it as a file for Unity to compile?

I have a system that procedurally generates C# code files. One of the things it does is analyse the existing version of the file with reflection to determine if anything has changed and it needs to regenerate. But if there are compile errors, there's no easy way to know if the generated script is causing the errors, or if it's fine and the errors are unrelated, or if the errors are preventing the last generated version from being loaded by reflection.

So my idea is to compile the procedural code files into a DLL and save that instead of saving them and letting Unity compile them. That way I will always be able to detect compile errors in the procedural code itself and errors elsewhere in the project shouldn't prevent it from being loaded properly for reflection.

So I have two questions:

  1. Will this even work like I'm expecting?
  2. If I only compile and save a DLL, the user won't easily be able to view the original code. I could save the code as text files alongside the DLL and/or put it in XML comments, but that would still be a bit disruptive to workflow. Is there a better way of doing it?




Aucun commentaire:

Enregistrer un commentaire