aws / amazon-gamelift-plugin-unity

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.
https://aws.amazon.com/gamelift/getting-started/
Apache License 2.0
76 stars 16 forks source link

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

Closed ArnCarveris closed 1 week ago

ArnCarveris commented 2 months ago

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 
levigerber commented 2 months ago

It seems like Net Standard 2.0 is included in the Unity API Compatability Layer. Does following the instructions here https://docs.unity3d.com/Manual/dotnetProfileSupport.html resolve this bug?

ArnCarveris commented 2 months ago

Nope, that was in AWSSDK.Core AWSConfig::GetConfig method, bc in net45 version gets config from System.Configuration.ConfigurationManager::get_AppSettings but it throws exception, but for netstandard2.0 it just returns hardcoded null, also it could be nice with targets had consistent API, bc non async method for netstandard2.0 became internal and that broke whole plugin bc many of code was relaying on that.

nullPointer373 commented 2 weeks ago

I came across a similar issue discussed here: https://github.com/aws/amazon-gamelift-plugin-unity/issues/67. It appears that IL2CPP does not support System.Configuration.ConfigurationManager, and the successful resolution involved using the AWS .NET SDK's netstandard2.0 DLLs from NuGet packages instead. Does the instructions provided in this guide https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/unity-special.html help in resolving the bug?

levigerber commented 1 week ago

Inferring the thumbs up to be resolved - closing. If this is not the case please feel free to reopen :)!