Visual Studio Solution File


A crucial part of Luna export process is compiling project scripts written in C# into JavaScript. In order to minimize changes required to the original codebase and smoothen developers' experience, Luna contains a set of .NET libraries that are compatible with UnityEngine.dll on the API level. That means your code can invoke functions, read constants and values and do other things without changes as if they were invoked against "real" UnityEngine.dll.

However, Luna is not a 100% replicate of Unity Engine for multiple reasons: performance, availability of certain APIs on the Web platform, obsolescence of some parts of the engine and so on. That renders a possibility of the code failing to compile against Luna's version of Unity runtime.

In most cases it is very easy to work around specific missing APIs by replacing them with availabile alternatives or even simply disabling parts of the code that aren't critical for the final product. This, however, requires manual intervention and Luna is doing its best to make this process as approacheable as possible.

Suggested workflow

In order to debug the compilation step and keep developers in the environment they are comfortable working in, Luna generates a separate solution file configured with all relevant C# files from the project.

Developers can then open that solution file using their IDE of choice should compilation fail:

Hitting "Open Luna solution" button will launch your default IDE with Luna solution loaded.

The solution is set up in such a way that the following always holds true:

  • All C# scripts are linked into the solution. You can change them here without the need to propagate the changes back to Unity's files.
  • Instead of "original" UnityEngine.dll, Luna's version is used. That means you can trigger a build from the IDE to see if the errors go away, code completion also works out of the box and so on.

Upon opening a solution and triggering a rebuild, developers are presented with the exact errors that stop Luna from compiling the project:

troubleshooting-luna-ui-vs-solutionCode completion hints are also available automatically:troubleshooting-luna-ui-code-completion

At Luna, we have found this setup extremley convenient to iterate on the code and make fixes whenever required.