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

Failed to Build (System.Memory.dll not allowed to be included or could not be found) #16

Open
EdevJogos opened this issue Oct 24, 2021 · 2 comments
Assignees

Comments

@EdevJogos
Copy link

Failed to Build it seems like (System.Memory.dll not allowed to be included or could not be found)

ArgumentException: The Assembly System.Runtime.CompilerServices.Unsafe is referenced by System.Memory ('Assets/Plugins/System.Memory.dll'). But the dll is not allowed to be included or could not be found.
Extracting referenced dlls failed.
Building Player failed
Component GUI Layer in Main Camera for Scene Assets/Scene/scene.unity is no longer available.
It will be removed after you edit this GameObject and save the Scene.
Failed to build player.
Exiting without the bug reporter. Application will terminate with return code 1

Full Editor.log: Editor.log

@alanmur
Copy link
Contributor

alanmur commented Oct 26, 2021

Hello, I tried to reproduce your issue, but I did not encounter it when I tried. I did log my repro steps (shown at the end of this post).
I don't know if you tried to build the project with the included build script. This automatically does some required steps, like downloading and building the GameLift SDK which is then put into the Assets\Plugins directory for use by Unity, and it also does a Unity build for both the game server and the game client. You are using a much newer version of Unity than the sample (or GameLift SDK) was created with, and Unity keeps making breaking changes, so keeping up with that can be a problem. I will list the steps you probably need to take, but include the steps I took for my own successful build as additional reference.

  1. Install Unity, and Visual Studio 2019 Community edition which the Unity installer includes as an option.
  2. Restart your computer to finish installation of Visual Studio 2019
  3. Run the Visual Studio 2019 installer, and make sure the .NET Desktop development workload is installed. Probably restart again.
  4. Clone the GitHub repository.
  5. Open the project in Unity using the Unity Hub to find it. (Ignore safe mode if it says anything about that, and do not try to build the player).
  6. Close Unity Editor.
  7. Run the Build\build.bat file.
  8. Everything should work. The result should look like this at the end.

BUILDING Server
The system cannot find the path specified.
USING "C:\Program Files\Unity\2021.1.26f1\Editor\Unity.exe" TO BUILD
BUILD COMPLETED SUCCESSFULLY. SEE C:\Users\alanmur\AppData\Local\Unity\Editor\Editor.log

BUILDING Client
The system cannot find the path specified.
USING "C:\Program Files\Unity\2021.1.26f1\Editor\Unity.exe" TO BUILD
BUILD COMPLETED SUCCESSFULLY. SEE C:\Users\alanmur\AppData\Local\Unity\Editor\Editor.log

IF you get the same error as I do in my STEP 11 below, then take the same steps (exactly) to remediate.

Then follow the rest of the instructions in the readme to deploy the server and connect using the client.

For additional reference, here are the steps that I took.

GOOD LUCK! Let me know if that helps, or if I can assist further.

  1. I downloaded the same version of Unity as you are using.

  2. I restarted the computer after Visual Studio 2019 Community had installed.

  3. I cloned the repository into a directory on my computer.

  4. I ran the Build\build.bat file in the terminal. This downloaded the GameLift Server SDK 4.0.0.
    This project targets .NET Framework 4.5, which is no longer supported with a Dev Pack.

  5. I opened the following file in the Visual Studio 2019 that was installed.
    aws-samples\amazon-gamelift-unity\SDK\GameLift_04_16_2020\GameLift-SDK-Release-4.0.0\GameLift-CSharp-ServerSDK-4.0.0\GameLiftServerSDKNet45.sln

  6. I chose to retarget the project to .NET 4.6.1. Visual Studio asked me to install the .NET for Desktop Visual Studio workload. (Weirdly enough this installed the .NET 4.5 targeting pack).

  7. I built the GameLift SDK in Visual Studio 2019 to validate that we are successful.

  8. I retargeted the GameLift SDK project BACK to 4.5, and it built now. You must already have got this far.

  9. I went back to the command line and ran the Build\build.bat file.

  10. buildconfig.bat couldn't find Unity. I manually set the file in buildconfig.bat by addiong this at line 86:

IF EXIST "%ProgramFiles%\Unity\2021.1.26f1\Editor\Unity.exe" SET UNITYEXE="%ProgramFiles%\Unity\2021.1.26f1\Editor\Unity.exe"
  1. I went back to the command line and ran the Build\build.bat file. I got this error in the Editor.log.

Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included on the current platform. Only one assembly with the same name is allowed per platform. (C:/aws-samples/amazon-gamelift-unity/Library/PackageCache/com.unity.nuget.newtonsoft-json@2.0.0/Runtime/Newtonsoft.Json.dll)
Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included on the current platform. Only one assembly with the same name is allowed per platform. (Assets/Plugins/Newtonsoft.Json.dll)
Scripts have compiler errors.

  1. To fix that, I went into aws-samples\amazon-gamelift-unity\Assets\Plugins and deleted the Newtonsoft.Json.dll.meta and Newtonsoft.Json.dll files.

  2. From the command line at aws-samples\amazon-gamelift-unity\Build I used
    buildconfig.bat Server
    to build the server (success). Capitalized S in Server is required!

  3. From the command line at aws-samples\amazon-gamelift-unity\Build I used
    buildconfig.bat Client
    to build the client (success). Capitalized C in Client is required.

The project build is complete now and you can deploy the server with the deploy.bat script according to the instructions in the readme.

@alanmur alanmur self-assigned this Oct 26, 2021
@EdevJogos
Copy link
Author

Hi, thanks for the detailed guide, i'll try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants