Code Monkey home page Code Monkey logo

aws / amazon-gamelift-plugin-unity Goto Github PK

View Code? Open in Web Editor NEW
76.0 9.0 17.0 4.16 MB

The Amazon GameLift Plugin for Unity contains libraries and native UI that makes it easier to access GameLift resources and integrate GameLift into your Unity game. You can use the GameLift Unity Plugin to access GameLift APIs and deploy AWS CloudFormation templates for common gaming scenarios.

Home Page: https://aws.amazon.com/gamelift/getting-started/

License: Apache License 2.0

C# 95.41% Python 3.77% PowerShell 0.81%

amazon-gamelift-plugin-unity's Introduction

Amazon GameLift Plugin for Unity Engine

GitHub license GitHub latest release version (by date) GitHub downloads all releases GitHub downloads latest release (by date)

Compatible with Unity 2021.3 LTS and 2022.3 LTS.

Overview

Amazon GameLift is a fully managed service that lets game developers to manage and scale dedicated game servers for session-based multiplayer games. The Amazon GameLift plugin for Unity provides tools that makes it quicker and easier to set up your Unity project for hosting on Amazon GameLift. Once the plugin is installed, you can access the plugin from within the Unity editor and start using it to integrate Amazon GameLift functionality into your client and server code. The plugin contains functionality to automatically bootstrap your game runtime environment to the AWS Cloud, fully test your game server integration with Amazon GameLift locally, and deploy your game servers on Amazon GameLift. For more information about using the plugin for Unity, see the Amazon GameLift plugin for Unity guide.

You can use built-in templates to deploy your game for the following common scenarios.

  • Single-region fleet: Deploy your game server to one fleet in a single AWS Region. Use this scenario to experiment with your install scripts and runtime deployment, as well as your integration.
  • FlexMatch fleet: Deploy your game server for hosting with a FlexMatch matchmaking solution. Amazon GameLift FlexMatch is a highly scalable and customizable matchmaking service for multiplayer games. Use this scenario to set up basic matchmaking components (including a rule set) that you can customize.

Each scenario uses an AWS CloudFormation template to deploy a resource stack for your game server solution. You can view and manage your resource stacks in the AWS Management Console for CloudFormation.

Prerequisites

  • Amazon GameLift plugin for Unity download package. Download a zip file from the GitHub Releases page. Or clone the plugin from the Github repo.
  • A compatible Unity editor (2021.3 LTS, 2022.3 LTS) with Dedicated Server Build Support module for Windows (and Linux if desired).
  • (Optional) A C# multiplayer game project with game code.
  • An AWS account with access permissions to use Amazon GameLift, Amazon S3, and AWS CloudFormation. See Set up programmatic access with long-term credentials.

Install the plugin

Complete the following steps to install and enable the plugin for your multiplayer game project. For more details, see the Amazon GameLift documentation.

  1. Install the Amazon GameLift Plugin for Unity.

    1. Find the com.amazonaws.gamelift-<version>.tgz file within the downloaded release zip or follow the contribution guide to build the tarball yourself.
    2. In your Unity project, open Window > Package Manager.
    3. Click + > Add package from tarball... and select the above tarball.
  2. Install the Amazon GameLift C# Server SDK for Unity plugin (aka. lightweight Unity plugin).

    1. Find and unzip the GameLift-CSharp-ServerSDK-UnityPlugin-<version>.zip file within the downloaded release zip or download it from Amazon GameLift's Getting Started.
    2. In your Unity project, open Edit > Project Settings > Package Manager.
    3. Under Scoped Registries, click on the + button and enter the values for the UnityNuGet scoped registry:
      Name: Unity NuGet
      Url: https://unitynuget-registry.azurewebsites.net
      Scope(s): org.nuget
      
    4. In your Unity project, open Window > Package Manager.
    5. Click + > Add package from tarball... and select the tarball within the unzipped folder, com.amazonaws.gameliftserver.sdk-<version>.tgz.
  3. (Optional) Import the sample project and configure the build settings.

    1. In your Unity project, select Amazon GameLift > Sample Game > Import Sample Game and import all assets.
    2. In your Unity project, select Amazon GameLift > Sample Game > Initialize Settings.

Contributing to this plugin

Prerequisites

  • Administrator rights on a Microsoft Windows OS
  • A supported Unity version
    • You also need to add the Unity editor folder (e.g. C:\Program Files\Unity\Hub\Editor\<version>\Editor\ ) to the Windows PATH environment variable.
  • Visual Studio 2019 (can be installed with Unity)
  • .NET Core 6 to build the core plugin source.
  • NodeJS/npm: https://nodejs.org/en/download/ to package the plugin.

Modifying the plugin code

  1. Clone the amazon-gamelift-plugin-unity repository from GitHub.
  2. Run Scripts~\windows\release.ps1 -Sdk <version> in PowerShell to build the plugin and dependent libraries (only needed once).
  3. In Unity Hub, create a new project.
  4. Open Unity Package Manager, import project from disk, and select the package.json located in the plugin's root folder.
  5. Setup code debugging in Unity: https://docs.unity3d.com/Manual/ManagedCodeDebugging.html, and change Unity project to Debug Mode.
  6. A .sln file should be created in the Unity project root, you can open that with Visual Studio.
  7. Make changes to the plugin code, and Unity should recompile after each change.
  8. Once changes are made, run the unit tests via Window > General > Test Runner.

Packaging the plugin

Run Scripts~\windows\release.ps1 -Sdk <version> to clean, build, export, and package the plugin with the server SDK in a single command.

Alternatively:

  1. Run Scripts~\windows\clean.ps1 to delete all dlls and temp files (If you want to build faster, you can comment out .clean-download-files execution).
  2. Run Scripts~\windows\build.ps1 to build dlls and sample game.
  3. Run Scripts~\windows\export.ps1 -Sdk <version> to export the plugin into a tarball (.tgz) and package it with the server SDK in the project root folder.

Testing the plugin

Follow instructions in Unity Docs to enable your project for testing:

  1. Open the Project manifest (located at <project>/Packages/manifest.json).
  2. Verify com.amazonaws.gamelift is present as a dependency.
  3. Add to the bottom of the file:
    "testables": [ "com.amazonaws.gamelift" ]

After enabling testing, the project tests can be run via Unity Test Runner.

FAQ

What Unity versions are supported?

The Amazon GameLift Plug-in for Unity is compatible only with officially supported versions of Unity 2021.3 LTS and 2022.3 LTS for Windows and Mac OS.

Where are the logs?

An additional error log file related to the Unity game project can be found in the following location: logs/amazon-gamelift-plugin-logs[YYYYMMDD].txt. Note that the log file is created once a day.

Amazon GameLift Resources

amazon-gamelift-plugin-unity's People

Contributors

amazon-auto avatar awsjackson avatar chefcarlos avatar dananden avatar junehop-amazon avatar levigerber avatar shashankj-aws avatar vinceq-aws avatar xmiao2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amazon-gamelift-plugin-unity's Issues

Error: The type 'FileIOPermission' exists in both, System.Security.Permissions and mscorlib

Hi,
after installing Amazaon GameLift Server SDK 5.1.0, I get the error:

Library\PackageCache\[email protected]\Editor\Core\Configuration\ProjectConfigurationBuildInjectorWithPlayerProcessor.cs(51,50): error CS0433: The type 'FileIOPermission' exists in both 'System.Security.Permissions Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'mscorlib Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

System.Security.Permissions Version=7.0.0.0 is used by Amazaon GameLift Server SDK 5.1.0.
mscorlib Version=4.0.0.0 seems to be part of Unity or .Net
[email protected] is used by "com.unity.services.cloud-diagnostics 1.0.6" and "com.unity.purchasing 4.10.0"

What can I do? (Without removal of cloud-diagnostics and purchasing package)

Conflict with FileIOPermission When Used Alongside Certain Packages (e.g., Unity IAP)

Hello,

I've encountered a conflict issue when using the GameLift Unity plugin alongside certain packages, such as Unity IAP (In-App Purchasing). The specific error that arises is related to the FileIOPermission type, which appears to exist in both System.Security.Permissions and mscorlib. This issue leads to a compilation error, preventing the project from building successfully. Here are the details of the error message:

Library/PackageCache/[email protected]/Editor/Core/Configuration/ProjectConfigurationBuildInjectorWithPlayerProcessor.cs(51,50): error CS0433: The type 'FileIOPermission' exists in both 'System.Security.Permissions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Still incompatible with NETCODE for GameObjects because Newtonsoft 12??

You posted last version as it's using Newtonsoft 13, but...

as soon as you install a plugin using Newtonsoft 13 like NETCODE for GameObjects, and then, downloading and installing your latest version, you can quickly see that this release isn't doing what's promising..

Is there any quick fix for that? I really suppose that when you posted a version with the main change "Update of Newtonsoft to 13" it should be included...

Captura de pantalla 2023-02-01 a les 1 35 25

BUG: missing netstandard2.0 target for plugins (all *.dll files)

Building SampleGame client standalone windows build with IL2CPP causes exception:

NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.AWSConfigs..cctor () [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.Runtime.ClientConfig..ctor (Amazon.Runtime.Internal.IDefaultConfigurationProvider defaultConfigurationProvider) [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.GameLift.AmazonGameLiftConfig..ctor () [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.GameLift.AmazonGameLiftClient..ctor (System.String awsAccessKeyId, System.String awsSecretAccessKey, Amazon.RegionEndpoint region) [0x00000] in <00000000000000000000000000000000>:0 
  at GameLiftClient..ctor (GameLiftApiCredentials apiCredentials, Delay delay, Logger logger) [0x00000] in <00000000000000000000000000000000>:0 
  at GameLift.Awake () [0x00000] in <00000000000000000000000000000000>:0 
Rethrow as TypeInitializationException: The type initializer for 'Amazon.AWSConfigs' threw an exception.
  at Amazon.Runtime.ClientConfig..ctor (Amazon.Runtime.Internal.IDefaultConfigurationProvider defaultConfigurationProvider) [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.GameLift.AmazonGameLiftConfig..ctor () [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.GameLift.AmazonGameLiftClient..ctor (System.String awsAccessKeyId, System.String awsSecretAccessKey, Amazon.RegionEndpoint region) [0x00000] in <00000000000000000000000000000000>:0 
  at GameLiftClient..ctor (GameLiftApiCredentials apiCredentials, Delay delay, Logger logger) [0x00000] in <00000000000000000000000000000000>:0 
  at GameLift.Awake () [0x00000] in <00000000000000000000000000000000>:0 

Namespace error

I created a Unity 2022.3.7f1 project, successfully downloaded the plugin, created my IAM user, gave it the proper permissions, created Anywhere Fleet, Registered compute, imported the sample game, Initialized the settings, but am unable to Launch the Server in Editor due to compilation errors.

In the GameLiftServer.cs script, the namespaces:

-Aws.GameLift
-Aws.GameLift.Server

  • GameLiftServerAPI
  • ServerParameters
  • GenericOutcome
  • ProcessParameters
  • LogParameters

are all unrecognizable.

I have

"com.amazonaws.gamelift": "file:C:/Users/aktra/Downloads/amazon-gamelift-plugin-unity-release-2.0.0/com.amazonaws.gamelift-2.0.0.tgz",

listed in my manifest.json

Unsure what else might be causing this issue.

Sample Game cannot create a game session

Hello, for some reason the sample project isn't able to create a game session, and when I compare the cmd log from https://docs.aws.amazon.com/gamelift/latest/developerguide/unity-plug-in-sample-game.html the to the one I'm on my computer, I see this being output before everything else:

Mono path[0] = 'C:/Users/David/Documents/Unity Projects/GameLift Sample Project Builds/Server/GameLift Sample Project_Data/Managed'
Mono config path = 'C:/Users/David/Documents/Unity Projects/GameLift Sample Project Builds/Server/MonoBleedingEdge/etc'
Initialize engine version: 2020.3.32f1 (12f8b0834f07)
[Subsystems] Discovering subsystems at path C:/Users/David/Documents/Unity Projects/GameLift Sample Project Builds/Server/GameLift Sample Project_Data/UnitySubsystems
Forcing GfxDevice: Null
GfxDevice: creating device client; threaded=0
NullGfxDevice:
    Version:  NULL 1.0 [1.0]
    Renderer: Null Device
    Vendor:   Unity Technologies
Begin MonoManager ReloadAssembly
- Completed reload, in  0.084 seconds
ERROR: Shader Sprites/Default shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
Microsoft Media Foundation video decoding to texture disabled: graphics device is Null, only Direct3D 11 and Direct3D 12 (only on desktop) are supported for hardware-accelerated video decoding.
ERROR: Shader Sprites/Mask shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader GUI/Text Shader shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
UnloadTime: 0.443900 ms
2022-04-25T20:17:2117 PID:21200 Log :) GAMELIFT AWAKE
2022-04-25T20:17:2126 PID:21200 Log :) I AM SERVER
2022-04-25T20:17:2127 PID:21200 Log :) GAMELIFT StartServer at port 33430.
2022-04-25T20:17:2127 PID:21200 Log :) SDK VERSION: 4.0.2
2022-04-25T20:17:2148 PID:21200 Log :) SERVER IS IN A GAMELIFT FLEET
2022-04-25T20:17:2159 PID:21200 Log :) PROCESSREADY SUCCESS.
2022-04-25T20:17:2159 PID:21200 Log :) GAMELIFT HEALTH CHECK REQUESTED (HEALTHY)
Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
ERROR: Shader UI/Default shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Legacy Shaders/VertexLit shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Standard' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Standard shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Standard' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
UnloadTime: 1.838900 ms

I think maybe that is the reason why it's not working properly, but it recognizes the connection on both Same Game build windows.

I'd appretiate some support. Thanks in advance.

Support plugin in Mac OS

In

_model.BuildFilePath = _controlDrawer.DrawFilePathField(_labelBuildFilePath, _model.BuildFilePath, "*", _titleServerFileDialog);
, the 3rd parameter in _controlDrawer.DrawFilePathField is set as “*”. But in MacOS, it is not recognized as wild card. This prevents choosing “.exe” binary. So I , instead, put an empty string “” as a workaround.

More compatiblity tests are needed

Deployment with EditorWindow - Launch Path Incorrect

I'm deploying a single-region fleet through the Editor Window of the plugin and it (likely) fails because the fleet cannot be created due to the LaunchPathParameter being incorrect:

Resource handler returned message: "Launch path must begin with '/local/game'.

I can see in the parameters tab in Cloudformation that the LaunchPathParameter is set to 'C:\game\serv.x86_64'. This is my configuration in the Editor Window:

image

Any ideas for temporary solutions? Also, if this is something that needs work, I'd be happy to help :)

Location Required For Anywhere Compute Type

Using the plugin through the Unity Editor, I created an Anywhere fleet, and now when I try to "Register Compute", I get this pop-up

"An error occurred when trying to register a compute.: Location is required for Anywhere compute type."

Cant get past the error, even after manually doing "register compute" through my CLI and specifying a location.

Multiple precompiled assemblies with the same name Castle.Core.dll If Mirror also installed

[Error] Multiple precompiled assemblies with the same name Castle.Core.dll included or the current platform. Only one assembly with the same name is allowed per platform. (Assets/Mirror/Tests/Common/Castle.Core.dll)

[Error] Multiple precompiled assemblies with the same name Castle.Core.dll included or the current platform. Only one assembly with the same name is allowed per platform. (D:/Unity/GameName/Library/PackageCache/com.amazonaws.gamelift@0a333f44cccc-1632387373971/Tests/Plugins/Castle.Core.dll)

I had to delete the test folders to get gamelift working.

Hotfix for missing .app app for local testing in Mac

In Setting up for local testing, the instruction asks to look for an .app file. However, starting from certain version of Unity, the build executable no longer contains .app.

You can still find the build executable from your build output directory, i.e. in the same directory that contains "Data", "MonoBleedingEdge", "Plugins" and "UnityPlayer.dylib" files.

However, this is not selectable in the Plugin UI because it requires the file to contain the .app extension. You can temporarily work around this by following these steps:

  1. Find the LocalTestWindow.cs file within unity assets
  2. In line 122, change “exe,app” to “”

Example:

From:

_labelServerPath, _model.BuildExecutablePath, "exe,app", _titleServerPathDialog,

To:

_labelServerPath, _model.BuildExecutablePath, "", _titleServerPathDialog,

Client loading forever

Hi Team

I can build client and server sample but when i run client, i click login and got loading forever

image

Server run with log4net error
image

Do you have any suggestion
Thanks

"The bucket does not allow ACLs" Workaround

Amazon S3 service has changed the default Object Ownership of new buckets to BucketOwnerEnforced. This disables ACLs on items uploaded to the bucket. If you try to create and bootstrap a new S3 bucket on the GameLift Unity plugin you will run into "The bucket does not allow ACLs" error.

Workaround:

  1. Navigate to the Permissions tab of the S3 bucket in the AWS Console.
  2. Scroll to Object Ownership and click "Edit"
  3. Enable ACLs with with Object Ownership set to "Object Writer". Save changes.
  4. Attempt to bootstrap again.

Error adding package: file:../com.amazonaws.gameliftserver.sdk-5.1.0.tgz

[Package Manager Window] Error adding package: file:../ExternalSDK/com.amazonaws.gameliftserver.sdk-5.1.0.tgz.
Unable to add package [file:../ExternalSDK/com.amazonaws.gameliftserver.sdk-5.1.0.tgz]:
  One or more dependencies could not be added to the local file system:
    org.nuget.log4net: shasum check failed for C:\Users\Firdi\AppData\Local\Unity\cache\npm\unitynuget-registry.azurewebsites.net\.tmp-8160-7Ew6mOPLSFgI\tarball\package.tgz
    Expected: 130876945c3108a3737a3673535dca07ac84a067
    Actual:   daa459deae45e8fa1c53dab652c13be6e9b9a729
    org.nuget.polly: shasum check failed for C:\Users\Firdi\AppData\Local\Unity\cache\npm\unitynuget-registry.azurewebsites.net\.tmp-8160-819qO1c1Sup6\tarball\package.tgz
    Expected: d88b08b054f71066e0620bfa39b28c96868ec581
    Actual:   daa459deae45e8fa1c53dab652c13be6e9b9a729
    org.nuget.system.configuration.configurationmanager: shasum check failed for C:\Users\Firdi\AppData\Local\Unity\cache\npm\unitynuget-registry.azurewebsites.net\.tmp-8160-nG8rodZjJLiU\tarball\package.tgz
    Expected: 36a73ad928337dd6389666559922e70212b6347f
    Actual:   daa459deae45e8fa1c53dab652c13be6e9b9a729
    org.nuget.system.security.accesscontrol: shasum check failed for C:\Users\Firdi\AppData\Local\Unity\cache\npm\unitynuget-registry.azurewebsites.net\.tmp-8160-oKLn4mKVourr\tarball\package.tgz
    Expected: 25c7f40c18fd6f7947c9df2aa9ba434dbcaf68ce
    Actual:   daa459deae45e8fa1c53dab652c13be6e9b9a729
    org.nuget.system.security.cryptography.protecteddata: shasum check failed for C:\Users\Firdi\AppData\Local\Unity\cache\npm\unitynuget-registry.azurewebsites.net\.tmp-8160-FYyzEM0VCic5\tarball\package.tgz
    Expected: 150812eaa25b897a2d5b280b6ee334b6b7a9212c
    Actual:   daa459deae45e8fa1c53dab652c13be6e9b9a729
    org.nuget.system.security.permissions: shasum check failed for C:\Users\Firdi\AppData\Local\Unity\cache\npm\unitynuget-registry.azurewebsites.net\.tmp-8160-1dYMdAkhM0da\tarball\package.tgz
    Expected: 0632e59e2a68f862983ab382ee9d38216745bb2b
    Actual:   daa459deae45e8fa1c53dab652c13be6e9b9a729
    org.nuget.system.security.principal.windows: shasum check failed for C:\Users\Firdi\AppData\Local\Unity\cache\npm\unitynuget-registry.azurewebsites.net\.tmp-8160-CjTMi5CN8Hi3\tarball\package.tgz
    Expected: 67ea822e61423deef4b30f3b0520f1d95bf09e78
    Actual:   daa459deae45e8fa1c53dab652c13be6e9b9a729
    org.nuget.websocketsharp.core: shasum check failed for C:\Users\Firdi\AppData\Local\Unity\cache\npm\unitynuget-registry.azurewebsites.net\.tmp-8160-QEd4k2WPsE9i\tarball\package.tgz
    Expected: ba56b8fcedddb521309c79a4626ff0e0d37a5ff1
    Actual:   daa459deae45e8fa1c53dab652c13be6e9b9a729
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

tbh i don't understand. im following the instruction but got this error

Need to detect JDK instead of just JRE installation

Previously, the plugin disables "Open Local Testing UI" button if JDK is installed but not JRE.

We have temporarily worked around this by enabling the button even if JRE/JDK is not installed. (See PR #10 )

The longer term fix is to be able to detect JDK/JRE properly

Open Local Test UI greyed out in GameLift Plugin Settings

I've been following the setup for local testing. For some reason it's not finding my JRE installation and still shows JRE as "Not Configured".

I already had my PATH pointing to my jdk-11.0.13 installation but downloaded, installed and updated my PATH to point to the jre1.8_0311 that was linked in settings.

Tried setting up JAVA_HOME as well but nothing seems to make it show up as configured. My CMD can find java.exe and use the correct path.

Is this me misunderstanding the setup or might there be an issue in the plugin?

The only way for me to get it to actually work was by making RefreshIsConfigured() in JavaSetting.cs to always return true.

Allow users to toggle audit-logging, versioning and encryption on bootstrap bucket

To be security compliant, users who create their own bootstrap bucket automatically get a bucket with versioning and encryption at rest enabled, as well as getting a second S3 bucket created in their account to store access audit logs of their bootstrap bucket. We should provide an option for users to disable those extra features (or at least make users aware of these changes).

Using GameLift in a project already containing AWS?

Linking the tarball results in conflicts with the existing AWS dlls in the project, but removing the exiting dlls results in the rest of the project that was using them being unable to find them (as they are in the tarball I think).
Also having the same issue with Serilog

Error when building client sample with IL2CPP

When i try to build the client sample project using IL2CPP i get the error bellow, it works with Mono, but i was wandering there's a way where i can use IL2CPP.

stdout:
Fatal error in Unity CIL Linker
Mono.Linker.LinkerFatalErrorException: ILLink: error IL1005: Amazon.Runtime.Internal.Util.InternalLog4netLogger.loadStatics(): Error processing method 'Amazon.Runtime.Internal.Util.InternalLog4netLogger.loadStatics()' in assembly 'AWSSDK.Core.dll'
 ---> System.InvalidOperationException: No action for the assembly log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a defined
   at Mono.Linker.AnnotationStore.GetAction(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.IsFullyPreserved(TypeDefinition type)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
   at Mono.Linker.Steps.MarkStep.MarkTypeVisibleToReflection(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
   at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.<>c__DisplayClass20_4.<HandleCall>b__7()
   at Mono.Linker.Dataflow.ReflectionPatternContext.RecordRecognizedPattern(IMemberDefinition accessedItem, Action mark)
   at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.HandleCall(MethodBody callingMethodBody, MethodReference calledMethod, Instruction operation, ValueNodeList methodParams, ValueNode& methodReturnValue)
   at Mono.Linker.Dataflow.MethodBodyScanner.HandleCall(MethodBody callingMethodBody, Instruction operation, Stack`1 currentStack)
   at Mono.Linker.Dataflow.MethodBodyScanner.Scan(MethodBody methodBody)
   at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.ScanAndProcessReturnValue(MethodBody methodBody)
   at Unity.Linker.Steps.UnityMarkStep.MarkReflectionLikeDependencies(MethodBody body, Boolean requiresReflectionMethodBodyScanner)
   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   at Unity.Linker.Steps.UnityMarkStep.MarkMethodBody(MethodBody body)
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason)
   at Unity.Linker.Steps.UnityMarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   --- End of inner exception stack trace ---
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Unity.Linker.Steps.UnityMarkStep.Process(LinkContext context)
   at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at Unity.Linker.UnityDriver.UnityRun(ILogger customLogger)
   at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(ILogger customLogger)
   at Unity.Linker.UnityDriver.RunDriver()
stderr:

UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEditorInternal.Runner.RunNetCoreProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEditorInternal.AssemblyStripper.RunAssemblyLinker (System.Collections.Generic.IEnumerable`1[T] args, System.String& out, System.String& err, System.String linkerPath, System.String workingDirectory) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEditorInternal.AssemblyStripper.StripAssembliesTo (System.String outputFolder, System.String& output, System.String& error, System.Collections.Generic.IEnumerable`1[T] linkXmlFiles, UnityEditorInternal.UnityLinkerRunInformation runInformation) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEditorInternal.AssemblyStripper.RunAssemblyStripper (UnityEditorInternal.UnityLinkerRunInformation runInformation) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEditorInternal.AssemblyStripper.StripAssemblies (System.String managedAssemblyFolderPath, UnityEditorInternal.BaseUnityLinkerPlatformProvider unityLinkerPlatformProvider, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, UnityEditor.RuntimeClassRegistry rcr, UnityEditor.ManagedStrippingLevel managedStrippingLevel) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEditorInternal.IL2CPPBuilder.Run () (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
DesktopStandalonePostProcessor.RunIL2CPP (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, System.Collections.Generic.List`1[T] cppPlugins) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
DesktopStandalonePostProcessor.SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs args, System.Collections.Generic.HashSet`1[T] filesToNotOverwrite) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <fea4138086dc4e42a285e0e1e88527ef>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Sample game server can get stuck with clients that never connected

With the sample game, if you have a client that doesn't correctly connect, the disconnect will leave the server hanging.

Error in the server log:

2024-01-08T11:55:44.767-08:00 | InvalidOperationException: The operation is not allowed on non-connected sockets. at System.Net.Sockets.TcpClient.GetStream () [0x00036] in <5fe808a9ce234d7cb9b1a4e14f988a80>:0 at NetworkServer.DisconnectPlayer (System.Int32 playerIdx) [0x0005a] in <0c43ac0a5cd042dd8688e9d7c4552bf4>:0 at NetworkServer.HandleDisconnect (System.Int32 playerIdx) [0x00000] in <0c43ac0a5cd042dd8688e9d7c4552bf4>:0 at NetworkServer.Send (System.String message, System.Int32 playerIndex, System.String operationName) [0x00037] in <0c43ac0a5cd042dd8688e9d7c4552bf4>:0 at NetworkServer.TransmitState () [0x0001b] in <0c43ac0a5cd042dd8688e9d7c4552bf4>:0 at GameLogic.Attract () [0x00027] in <0c43ac0a5cd042dd8688e9d7c4552bf4>:0 at GameLogic.Update () [0x0000b] in <0c43ac0a5cd042dd8688e9d7c4552bf4>:0
  | 2024-01-08T11:55:44.767-08:00 | 2024-01-08T19:55:4471 PID:2083 Log SERVER: Frame: 111900 DISCONNECT: Player 0

And you'll see that coming over and over again. In general, it would be good to have some sort of time after which the game server terminates itself after session has started to avoid long hanging failed sessions.

Support for Unity2021.x required

Officially the plugin only supports Unity2020.x and it seams that it is not compatible with Unity2021.x which is a huge roadblock. With Unity2021.x Unity introduced a new way of implementing multiplayer games with netcode for gameobjects which is a real gamechanger and should be the default architecture when building multiplayer games with Unity. Unfortunatley as stated by the documentation the plugin is not compatible for real with Unity2021.x

While we can get the server side and AWS gamelift fleet part up and running (following the doc: https://docs.aws.amazon.com/gamelift/latest/developerguide/integration-unity-server.html)
it does not work for the client side of things (https://docs.aws.amazon.com/gamelift/latest/developerguide/integration-unity-client.html)

Most likely Unity is not able to find any assemblies mentioned and required in the doc, leading to compile errors and therefore making gamelift not usable at the moment.

We hit a really hard roadblock here since it is stopping us from playtesting our game while simultaniously setting up a working backend. Now we have basically the choice to ditch AWS Gamelift as backend of our choice or to fall back to older versions of unity, compromising on recommended architecture.

I really hope we can have 2021.x compatibility soon.

.Net standard 2.0?

is the readme outdated? It says to use .net 4.x but nowadays .net standard 2.0 option is the default on newer version of Unity.
Also the dll seems to be built against unsafe library 4.0.4.1 while I'd like to use 6.0.0.0 for the rest of my project

Newtonsoft.Json version

In the latest update it says:

Update Newtonsoft.Json from 12.0.0 to 13.0.1

However, after importing Unity generates an error that says otherwise:

Assembly 'Packages/com.amazonaws.gamelift/Runtime/Plugins/GameLiftServerSDKNet45.dll' will not be loaded due to errors: GameLiftServerSDKNet45 references strong named Newtonsoft.Json Assembly references: 12.0.0.0
Found in project: 13.0.0.0

[BLOCKER] NotSupportedException with il2cpp builds

I can build with il2cpp, but on Android and iOS and windows, but it fails to initialize the gamelift client:

NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.AWSConfigs.GetConfig (System.String name) [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.AWSConfigs..cctor () [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.Runtime.ClientConfig..ctor () [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.GameLift.AmazonGameLiftConfig..ctor () [0x00000] in <00000000000000000000000000000000>:0 
  at Amazon.GameLift.AmazonGameLiftClient..ctor (System.String awsAccessKeyId, System.String awsSecretAccessKey, Amazon.RegionEndpoint region) [0x00000] in <00000000000000000000000000000000>:0 
  at Framework.Core.Managers.GameLiftClientManager+<GameLiftClientInit>d__22.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <0000000000000000000000000

I followed the docs, and extended the link.xml in the Assets folder but it did not help.

It only happens when building with il2cpp for mobile and windows platforms. Mono builds work fine. Editor works fine.

The code (that throws the exception) is approximately the same as the example:

_client = new AmazonGameLiftClient(
    "<...>",
    "<...>",
    RegionEndpoint.USEast1
);

Edit:
Just found this on the unity forums:
"IL2CPP does not support System.Configuration.ConfigurationManager, and we don't plan to add support for it soon, unforunately."
Which means you cannot submit a build with il2cpp on iOS for example, since mono is not authorized there.

Sorry for the ping, but could you please look into this @xmiao2 @dananden @AWSJackson?

Inconsistent 1.2.1 release

Hi,
We were waiting for the 1.2.1 release.
2 days ago it's finally arrived but I noticed some problems with it.
I have downloaded all links:

  • com.amazonaws.gamelift-1.2.1.tgz
  • Source code (zip)
  • Source code (tar.gz)

I've compared the content of them and Source codes are okay.
Zip & tar.gz are binary the same once uncompressed.

The content of the .tgz file (which is the one we are using) have several differences from the others.
First of all, the dependency for Newtonsoft.Json is not changed in the .tgz file.
Furthermore, in the .tgz changelog there is an entry for the 1.2.2 version that is not released yet.

I have made some screenshot of my comparisons.

Can you provide an explanation or a fix for this?

source-codes-comparison

compare_01
compare_02
compare_03

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.