I am trying to use a Unity3d game as GameList client.
According to the GameLift forum, it seems Amazon does not recommend to use a game client as a GameLift client directly.
But I want to give it a try because I do not want one more separate game service.
The first step is downloading AWS SDK source code from GitHub and building the .net35 version dll;
Put the AWSSDK.Core.dll and AWSSDK.GameLift.dll into /Assets/Plugins;
Create a new derived class from MonoBehaviour to create the AmazonGameLiftClient, below is my code:
public class MyGameLiftClient : MonoBehaviour
{
private void Awake()
{
AmazonGameLiftConfig gameLiftConfig =
new AmazonGameLiftConfig {RegionEndpoint = RegionEndpoint.USWest1};
AmazonGameLiftClient client = new AmazonGameLiftClient(
"AwsAccessKeyId",
"AwsSecrectAcessKey",
gameLiftConfig);
}
}
Here I encountered the first problem: Failed to create the GameLiftClient
After fixing the above problem, I tried to use the AmazonGameLiftClient to list the fleets:
AmazonGameLiftConfig gameLiftConfig = new AmazonGameLiftConfig {RegionEndpoint = RegionEndpoint.USWest1};
AmazonGameLiftClient client = new AmazonGameLiftClient(
"awsAccessKeyId",
"awsAccessSecretKey",
gameLiftConfig);
ListFleetsRequest listFleetsRequest = new ListFleetsRequest();
ListFleetsResponse fleets = client.ListFleets(listFleetsRequest);
But I get below exception:
NotSupportedException: https://gamelift.us-west-1.amazonaws.com/
System.Net.WebRequest.GetCreator (System.String prefix)
System.Net.WebRequest.Create (System.Uri requestUri)
Amazon.Runtime.Internal.HttpRequest..ctor (System.Uri requestUri)
Amazon.Runtime.Internal.HttpWebRequestFactory.CreateHttpRequest (System.Uri requestUri)
Amazon.Runtime.Internal.HttpHandler`1[System.IO.Stream].CreateWebRequest (IRequestContext requestContext)
Amazon.Runtime.Internal.HttpHandler`1[System.IO.Stream].InvokeSync (IExecutionContext executionContext)
Amazon.Runtime.Internal.PipelineHandler.InvokeSync (IExecutionContext executionContext)
Amazon.Runtime.Internal.Unmarshaller.InvokeSync (IExecutionContext executionContext)
Amazon.Runtime.Internal.PipelineHandler.InvokeSync (IExecutionContext executionContext)
Amazon.Runtime.Internal.ErrorHandler.InvokeSync (IExecutionContext executionContext)
- I added some more configuration into my aws.config to fix it, below is my whole aws.config:
<configuration>
<configSections>
<section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
<section name="system.diagnostics" type="System.Diagnostics.DiagnosticsConfigurationHandler" />
<sectionGroup name="system.net" type="System.Net.Configuration.NetSectionGroup, System">
<section name="authenticationModules" type="System.Net.Configuration.AuthenticationModulesSection, System" />
<section name="connectionManagement" type="System.Net.Configuration.ConnectionManagementSection, System" />
<sectionGroup name="mailSettings" type="System.Net.Configuration.MailSettingsSectionGroup, System">
<section name="smtp" type="System.Net.Configuration.SmtpSection, System" />
</sectionGroup>
<section name="requestCaching" type="System.Net.Configuration.RequestCachingSection, System" />
<section name="settings" type="System.Net.Configuration.SettingsSection, System" />
<section name="webRequestModules" type="System.Net.Configuration.WebRequestModulesSection, System" />
</sectionGroup>
</configSections>
<aws>
<logging logTo="Log4Net"/>
<csmConfig csmEnabled="false"/>
</aws>
<system.diagnostics>
<trace autoflush="true" />
</system.diagnostics>
<system.net>
<authenticationModules>
<add type="System.Net.DigestClient" />
<add type="System.Net.NegotiateClient" />
<add type="System.Net.KerberosClient" />
<add type="System.Net.NtlmClient" />
<add type="System.Net.BasicClient" />
</authenticationModules>
<connectionManagement>
<add address="*" maxconnection="2" />
</connectionManagement>
<webRequestModules>
<add prefix="http"
type="System.Net.HttpRequestCreator"
/>
<add prefix="https"
type="System.Net.HttpRequestCreator"
/>
<add prefix="file"
type="System.Net.FileWebRequestCreator"
/>
</webRequestModules>
</system.net>
</configuration>
- Now I get another exception:
MissingMethodException: Method not found: 'System.Net.ServicePoint.SetTcpKeepAlive'.
Amazon.Runtime.Internal.HttpHandler`1[System.IO.Stream].CreateWebRequest (IRequestContext requestContext)
Amazon.Runtime.Internal.HttpHandler`1[System.IO.Stream].InvokeSync (IExecutionContext executionContext)
Amazon.Runtime.Internal.PipelineHandler.InvokeSync (IExecutionContext executionContext)
Amazon.Runtime.Internal.Unmarshaller.InvokeSync (IExecutionContext executionContext)
Amazon.Runtime.Internal.PipelineHandler.InvokeSync (IExecutionContext executionContext)
Amazon.Runtime.Internal.ErrorHandler.InvokeSync (IExecutionContext executionContext)
Does anyone have an idea about this exception?
My Environment:
- OS: Mac OS X 10.14.1
- Unity3d: 2018.2.12f1
- AWS SDK Core:3.3.29.10(.net35)
- AWS SDK GameLift: 3.3.12.29(.net35)