Apparently the AWS Gamelift API uses reflection or some mechanism that causes the Unity compilers to over aggressively strip required assemblies. As a result, you are limited to using the Mono compiler which does allow for turning off stripping. IL2CPP does not have a similar option. For IL2CPP, you can control the stripping through entries in the link.xml file (\Assets\link.xml). So far, I have not had success using the link.xml approach.
After using the entries below in the link.xml, a number of exceptions are prevented, but this exception still remains.
2020-03-16 12:12:14.622 13883-13898/com.company.app E/Unity: 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 GameLiftClient.GetConnectionInfo (System.String& ip, System.Int32& port, System.String& playerSessionId) [0x00000] in <00000000000000000000000000000000>:0 at GameLift.GetConnectionInfo (System.String& ip, System.Int32& port, System.String
link.xml
<linker>
<assembly fullname="UnityEngine">
<type fullname="UnityEngine.Networking.UnityWebRequest" preserve="all" />
<type fullname="UnityEngine.Networking.UploadHandlerRaw" preserve="all" />
<type fullname="UnityEngine.Networking.UploadHandler" preserve="all" />
<type fullname="UnityEngine.Networking.DownloadHandler" preserve="all" />
<type fullname="UnityEngine.Networking.DownloadHandlerBuffer" preserve="all" />
</assembly>
<assembly fullname="mscorlib">
<namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>
<assembly fullname="System">
<namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.Core" preserve="all"/>
<assembly fullname="AWSSDK.CognitoIdentity" preserve="all"/>
<assembly fullname="AWSSDK.CognitoSync" preserve="all"/>
<assembly fullname="AWSSDK.DynamoDBv2" preserve="all"/>
<assembly fullname="AWSSDK.Kinesis" preserve="all"/>
<assembly fullname="AWSSDK.KinesisFirehose" preserve="all"/>
<assembly fullname="AWSSDK.Lambda" preserve="all"/>
<assembly fullname="AWSSDK.MobileAnalytics" preserve="all"/>
<assembly fullname="AWSSDK.S3" preserve="all"/>
<assembly fullname="AWSSDK.SecurityToken" preserve="all"/>
<assembly fullname="AWSSDK.SimpleEmail" preserve="all"/>
<assembly fullname="AWSSDK.SimpleNotificationService" preserve="all"/>
<assembly fullname="AWSSDK.SQS" preserve="all"/>
<assembly fullname="AWSSDK.IdentityManagement" preserve="all"/>
<assembly fullname="AWSSDK.GameLift" preserve="all"/>
<assembly fullname="System.Configuration" preserve="all"/>
<assembly fullname="System.SecurityUtils" preserve="all"/>
<assembly fullname="System.ComponentModel" preserve="all"/>
<assembly fullname="System.Activator" preserve="all"/>
<assembly fullname="System.RuntimeType" preserve="all"/>
</linker>
Is there anyway, using the link.xml or another mechanism, to disable assembly stripping in Unity so that the IL2CPP compiler may be used?
This error is not related to managed code stripping, actually. This happens because IL2CPP does not support System.Configuration.ConfigurationManager
.
You'll need to see if it is possible to use the AWS Gamelift API without accessing the configuration manager API.