Failed to create AmazonGameLiftClient in Unity3d

与世无争的帅哥 提交于 2019-12-23 12:01:19

问题


I use below code to create GameClient in Unity3d:

AmazonGameLiftClient client = 
        new AmazonGameLiftClient("accessKeyId",
                                 "accessKey",
                                  RegionEndpoint.CNNorth1);

Above code is the first line in Awake(), no any other leading codes.

I get below error:

NullReferenceException: Object reference not set to an instance of an object
Amazon.CSMSection.get_CSMEnabled ()
Amazon.Util.CSMConfig.Configure (Amazon.CSMSection section)
Amazon.Util.Internal.RootConfig..ctor ()
Amazon.AWSConfigs..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Amazon.AWSConfigs
Amazon.Runtime.ClientConfig..ctor ()
Amazon.GameLift.AmazonGameLiftConfig..ctor ()
Amazon.GameLift.AmazonGameLiftClient..ctor (System.String awsAccessKeyId, System.String awsSecretAccessKey, Amazon.RegionEndpoint region)

Is there anything I forgot to do? I assume the root cause is I do not put app.config in the correct place. So AWS SDK does not init correctly, but I have not found any tutorial for using Unity3d as Amazon GameLift client :(

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)

Update: The AWS SDK relies on System.ConfigurationManager which seems not available in Unity3d projects. It seems the root cause of the NullReferenceException.


回答1:


Please refer to this answer, it completely solves this question.



来源:https://stackoverflow.com/questions/53432086/failed-to-create-amazongameliftclient-in-unity3d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!