Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler show error on Unity Editor for Windows #16

Open
khoint-uit opened this issue Mar 3, 2022 · 0 comments
Open

Compiler show error on Unity Editor for Windows #16

khoint-uit opened this issue Mar 3, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@khoint-uit
Copy link

khoint-uit commented Mar 3, 2022

NOTE: Your issue may already be reported! Please search on the issue tracker before creating one.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'ProjectSettings',fill "Microsoft.Unity.Analyzers" and select version 1.12.0
  2. Select Compiler Type: BuiltIn
  3. Click on 'apply'
  4. Waiting progress endless.
  5. Restart UnityEditor, error report:
stdout:

stderr:

Specify which project file to use because this 'D:\GitHubs\example' contains more than one project file.

Environment

Platform: Editor(Windows)
Unity version: 2021.2.11f1
Build options:

Additional context
The BuiltIn Compiler worked perfect in Unity Editor for MacOs.
Suggest solution
Change the Setup function inside CompilerInfo to this:

 public void Setup(ProcessStartInfo psi, string responseFile, RuntimePlatform platform)
        {
            if (platform == RuntimePlatform.WindowsEditor
                && Path.EndsWith(".exe"))
            {
                psi.FileName  = System.IO.Path.GetFullPath(Path);
                psi.Arguments = "/shared /noconfig @" + responseFile;
            }
            else
            {
                psi.FileName  = System.IO.Path.GetFullPath(RuntimePath);
                psi.Arguments = "\"" + Path + "\"" + " /noconfig @" + responseFile;
            }
            psi.CreateNoWindow  = true;
            psi.UseShellExecute = false;
        }

I changed the Path to "\"" + Path + "\"" to avoid problem with Windows file path since C:\Program Files\Unity\Hub\Editor\2021.2.11f1\Editor\Data\DotNetSdkRoslyn\csc.dll has space in the path string.

I also found that CustomCompiler_2021 need to change in this function

private string GetOutDir(string dagName)
        {
            if (dagName.EndsWith("E")) return "Library/ScriptAssemblies";

            var unityVersions = Application.unityVersion.Split('.');
            if (int.Parse(unityVersions[0]) == 2021)
                //return "Library/PlayerScriptAssemblies";
                return "Library/ScriptAssemblies";
            else
                return "Library/Bee/PlayerScriptAssemblies";
        }

since the Library/PlayerScriptAssemblies was not found.

@khoint-uit khoint-uit added the bug Something isn't working label Mar 3, 2022
@khoint-uit khoint-uit changed the title Compiler show error on Unity Windows Editor Compiler show error on Unity Editor for Windows Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants