使用 AWS Gamelift 的 Unity。编辑器很好,但构建到 IOS 时出现 NotSupportedException
Unity using AWS Gamelift. Editor fine, but NotSupportedException in build to IOS
我完全卡住了。我的 unity 游戏在编辑器中运行良好,但在 IOS 上启动时崩溃。我正在将 AWS Gamelift 用于多人游戏,这可能是罪魁祸首,因为它在集成之前构建良好。对于实际的网络代码,我正在使用新的统一 DOTS 网络代码包。
在我的插件文件夹中,我有以下客户端 dll。
- AWSSDK.CognitoIdentity
- AWSSDK.CognitoIdentity提供商
- AWSSDK.CognitoSync
- AWSSDK.Core
- AWSSDK.Extensions.CognitoAuthentication
- AWSSDK.Gamelift
- AWSSDK.Lambda
- AWSSDK.SecurityToken
- Microsoft.Bcl.AsyncInterfaces
- System.Threading.Tasks.Extensions
- log4net
在编辑器中一切运行完美。我可以连接到 GameLift,创建游戏会话等。当我构建时,它成功完成,但在启动时崩溃,显示一个带有天空盒的空场景,并且 Xcode 控制台中出现以下错误:
... some other outputs for initialization...
NotSupportedException: System.Web.UI.WebResourceAttribute::set_CdnSupportsSecureConnection
at System.Web.UI.WebResourceAttribute.set_CdnSupportsSecureConnection (System.Boolean value) [0x00000] in <00000000000000000000000000000000>:0
at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00000] in <00000000000000000000000000000000>:0
at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0
at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0
at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T] (System.Reflection.Assembly element) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.TypeManager.InitializeAllComponentTypes () [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.TypeManager.Initialize () [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.EntityGuid..cctor () [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.World..ctor (System.String name, Unity.Entities.WorldFlags flags) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.DefaultWorldInitialization.Initialize (System.String defaultWorldName, System.Boolean editorWorld) [0x00000] in <00000000000000000000000000000000>:0
(Filename: currently not available on il2cpp Line: -1)
ArgumentException: Unknown Type:`Unity.Entities.CompanionLink` All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].
at Unity.Entities.TypeManager.ManagedException (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.TypeManager.GetTypeIndex (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.AttachToEntityClonerInjection.Initialize () [0x00000] in <00000000000000000000000000000000>:0
Rethrow as TypeInitializationException: The type initializer for 'Unity.Entities.AttachToEntityClonerInjection' threw an exception.
(Filename: currently not available on il2cpp Line: -1)
[Subsystems] Loading plugin UnityARKit for subsystem ARKit-Input...
[Subsystems] UnityARKit successfully registered Provider for ARKit-Input
NullReferenceException: Object reference not set to an instance of an object.
at Unity.NetCode.ConvertToClientServerEntity.Awake () [0x00000] in <00000000000000000000000000000000>:0
... some other debug messages spamming null reference exceptions that seem to be related to the above errors...
我怀疑这与 IOS 构建的代码剥离有关。我的 link.xml 文件如下(基于谷歌搜索,不知道我在这里做什么)。
<?xml version="1.0" encoding="utf-8"?>
<linker>
<assembly fullname="UnityEngine">
<type fullname="UnityEngine.Experimental.Networking.UnityWebRequest" preserve="all" />
<type fullname="UnityEngine.Experimental.Networking.UploadHandlerRaw" preserve="all" />
<type fullname="UnityEngine.Experimental.Networking.UploadHandler" preserve="all" />
<type fullname="UnityEngine.Experimental.Networking.DownloadHandler" preserve="all" />
<type fullname="UnityEngine.Experimental.Networking.DownloadHandlerBuffer" preserve="all" />
</assembly>
<assembly fullname="log4net"/>
<assembly fullname="Google.Protobuf"/>
<assembly fullname="System.Runtime.CompilerServices.Unsafe"/>
<assembly fullname="websocket-sharp"/>
<assembly fullname="AWSSDK.Core" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.CognitoIdentity" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.CognitoIdentityProvider" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.CognitoSync" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.IdentityManagement" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.SecurityToken" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.DynamoDBv2" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.Lambda" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.Extensions.CognitoAuthentication" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.GameLift" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
</linker>
奇怪的是,如果我删除保留 log4net.dll.
的行,我可以让程序启动
但是,这样做之后,当我单击登录到 gamelift 按钮时,出现了一个不同的错误,似乎缺少与 log4net 相关的内容。 (我在注册和其他方面遇到了同样的错误)。奇怪的是,在我尝试使用 gamelift 之前,程序启动并运行良好。
这是 Xcode 中的不同错误。这是我尝试连接到 Cognito 以登录后唯一出现的内容。
NullReferenceException: Object reference not set to an instance of an object.
at Amazon.Runtime.Internal.Util.InternalLog4netLogger..ctor (System.Type declaringType) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.Logger..ctor (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.Logger.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.EnvironmentVariableInternalConfiguration..ctor () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.FallbackInternalConfigurationFactory.Reset () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.ClientConfig.get_RetryMode () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.AmazonServiceClient.BuildRuntimePipeline () [0x00000] in <00000000000000000000000000000000>:0
at SignInManager+<TrySignIn>d__10.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskCache.CreateCacheableTask[TResult] (TResult result) [0x00000] in <00000000000000000000000000000000>:0
at SignInManager.TrySignIn (EmailAddress email, Password password, LoginEvents+SignInCallback callback) [0x00000] in <00000000000000000000000000000000>:0
at LoginEvents+SignInEvent.Invoke (EmailAddress email, Password password, LoginEvents+SignInCallback callback) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallback`1[TEventType].Invoke (TEventType evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.PointerEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.SendPositionBasedEvent[TArg] (UnityEngine.Vector3 mousePosition, UnityEngine.Vector3 delta, System.Func`4[T1,T2,T3,TResult] evtFactory, TArg arg) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.SendIMGUIEvents () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.Update () [0x00000] in <00000000000000000000000000000000>:0
Rethrow as TypeInitializationException: The type initializer for 'Amazon.Runtime.Internal.FallbackInternalConfigurationFactory' threw an exception.
at Amazon.Runtime.ClientConfig.get_RetryMode () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.AmazonServiceClient.BuildRuntimePipeline () [0x00000] in <00000000000000000000000000000000>:0
at SignInManager+<TrySignIn>d__10.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskCache.CreateCacheableTask[TResult] (TResult result) [0x00000] in <00000000000000000000000000000000>:0
at SignInManager.TrySignIn (EmailAddress email, Password password, LoginEvents+SignInCallback callback) [0x00000] in <00000000000000000000000000000000>:0
at LoginEvents+SignInEvent.Invoke (EmailAddress email, Password password, LoginEvents+SignInCallback callback) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallback`1[TEventType].Invoke (TEventType evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.PointerEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.SendPositionBasedEvent[TArg] (UnityEngine.Vector3 mousePosition, UnityEngine.Vector3 delta, System.Func`4[T1,T2,T3,TResult] evtFactory, TArg arg) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.SendIMGUIEvents () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.Update () [0x00000] in <00000000000000000000000000000000>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.SendOrPostCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.UnitySynchronizationContext:Exec()
UnityEngine.UnitySynchronizationContext:Exec()
(Filename: currently not available on il2cpp Line: -1)
所以因为这是一个类型初始化问题,所以我怀疑代码剥离有问题。但是我完全不懂代码剥离,这种预感只是基于我阅读的一些论坛帖子。
任何想法都会非常有帮助。我卡住了。
我用 很多 的难度和扎实的工作周设法解决了这个问题。这是我为修复它所做的步骤。以防以后其他人遇到问题。
- 确保我已经更新了 AWS SDK dll。我在 rider 中用 nuget 得到了这些,然后将 netstandard2.0 dll 拖到插件文件夹中。注意:仔细查看 nuget 中列出的依赖项。我必须使用稍旧版本的 AWS SDK 才能与 cognitoAuthentification.dll.
兼容
这是 rider 中的包的屏幕截图。包版本似乎很重要。仔细检查依赖项。
使用 Amazon.Extensions.CognitoAuthentication.dll 而不是 AWSSDK.Extensions.CognitoAuthentication.dll
删除 link.xml 文件中的所有内容。仅包含以下条目:
<linker>
<assembly fullname="AWSSDK.Core">
<type fullname="Amazon.Util.Internal.PlatformServices.NetworkReachability" preserve="all"/>
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
</linker>
检查所有其他插件,并逐一检查排除 iOS。首先,检查它是否破坏了编辑器中的桌面播放。然后检查它是否破坏了 iOS 构建中的任何内容。我认为这可能是最重要的一步。
进入unityeditor.app包内容,往下进入monobleedingedge/unityjit/拖拽Mono.Posix、System.Core、System.Configuration进入我的插件文件夹。
请注意,每次我更改 unity 插件文件夹中的 dll 时,我都必须重新启动 unity 以消除控制台错误和重新加载脚本失败。
如果有人好奇的话,这是我的插件文件夹的截图
无论如何...真正的答案是这不是一个用户友好的系统。
我完全卡住了。我的 unity 游戏在编辑器中运行良好,但在 IOS 上启动时崩溃。我正在将 AWS Gamelift 用于多人游戏,这可能是罪魁祸首,因为它在集成之前构建良好。对于实际的网络代码,我正在使用新的统一 DOTS 网络代码包。
在我的插件文件夹中,我有以下客户端 dll。
- AWSSDK.CognitoIdentity
- AWSSDK.CognitoIdentity提供商
- AWSSDK.CognitoSync
- AWSSDK.Core
- AWSSDK.Extensions.CognitoAuthentication
- AWSSDK.Gamelift
- AWSSDK.Lambda
- AWSSDK.SecurityToken
- Microsoft.Bcl.AsyncInterfaces
- System.Threading.Tasks.Extensions
- log4net
在编辑器中一切运行完美。我可以连接到 GameLift,创建游戏会话等。当我构建时,它成功完成,但在启动时崩溃,显示一个带有天空盒的空场景,并且 Xcode 控制台中出现以下错误:
... some other outputs for initialization...
NotSupportedException: System.Web.UI.WebResourceAttribute::set_CdnSupportsSecureConnection
at System.Web.UI.WebResourceAttribute.set_CdnSupportsSecureConnection (System.Boolean value) [0x00000] in <00000000000000000000000000000000>:0
at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00000] in <00000000000000000000000000000000>:0
at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0
at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0
at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T] (System.Reflection.Assembly element) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.TypeManager.InitializeAllComponentTypes () [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.TypeManager.Initialize () [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.EntityGuid..cctor () [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.World..ctor (System.String name, Unity.Entities.WorldFlags flags) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.DefaultWorldInitialization.Initialize (System.String defaultWorldName, System.Boolean editorWorld) [0x00000] in <00000000000000000000000000000000>:0
(Filename: currently not available on il2cpp Line: -1)
ArgumentException: Unknown Type:`Unity.Entities.CompanionLink` All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].
at Unity.Entities.TypeManager.ManagedException (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.TypeManager.GetTypeIndex (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Entities.AttachToEntityClonerInjection.Initialize () [0x00000] in <00000000000000000000000000000000>:0
Rethrow as TypeInitializationException: The type initializer for 'Unity.Entities.AttachToEntityClonerInjection' threw an exception.
(Filename: currently not available on il2cpp Line: -1)
[Subsystems] Loading plugin UnityARKit for subsystem ARKit-Input...
[Subsystems] UnityARKit successfully registered Provider for ARKit-Input
NullReferenceException: Object reference not set to an instance of an object.
at Unity.NetCode.ConvertToClientServerEntity.Awake () [0x00000] in <00000000000000000000000000000000>:0
... some other debug messages spamming null reference exceptions that seem to be related to the above errors...
我怀疑这与 IOS 构建的代码剥离有关。我的 link.xml 文件如下(基于谷歌搜索,不知道我在这里做什么)。
<?xml version="1.0" encoding="utf-8"?>
<linker>
<assembly fullname="UnityEngine">
<type fullname="UnityEngine.Experimental.Networking.UnityWebRequest" preserve="all" />
<type fullname="UnityEngine.Experimental.Networking.UploadHandlerRaw" preserve="all" />
<type fullname="UnityEngine.Experimental.Networking.UploadHandler" preserve="all" />
<type fullname="UnityEngine.Experimental.Networking.DownloadHandler" preserve="all" />
<type fullname="UnityEngine.Experimental.Networking.DownloadHandlerBuffer" preserve="all" />
</assembly>
<assembly fullname="log4net"/>
<assembly fullname="Google.Protobuf"/>
<assembly fullname="System.Runtime.CompilerServices.Unsafe"/>
<assembly fullname="websocket-sharp"/>
<assembly fullname="AWSSDK.Core" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.CognitoIdentity" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.CognitoIdentityProvider" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.CognitoSync" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.IdentityManagement" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.SecurityToken" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.DynamoDBv2" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.Lambda" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.Extensions.CognitoAuthentication" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.GameLift" preserve="all">
<type fullname ="Amazon.*" preserve = "all" />
<namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
</assembly>
</linker>
奇怪的是,如果我删除保留 log4net.dll.
的行,我可以让程序启动但是,这样做之后,当我单击登录到 gamelift 按钮时,出现了一个不同的错误,似乎缺少与 log4net 相关的内容。 (我在注册和其他方面遇到了同样的错误)。奇怪的是,在我尝试使用 gamelift 之前,程序启动并运行良好。
这是 Xcode 中的不同错误。这是我尝试连接到 Cognito 以登录后唯一出现的内容。
NullReferenceException: Object reference not set to an instance of an object.
at Amazon.Runtime.Internal.Util.InternalLog4netLogger..ctor (System.Type declaringType) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.Logger..ctor (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Util.Logger.GetLogger (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.EnvironmentVariableInternalConfiguration..ctor () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.FallbackInternalConfigurationFactory.Reset () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.ClientConfig.get_RetryMode () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.AmazonServiceClient.BuildRuntimePipeline () [0x00000] in <00000000000000000000000000000000>:0
at SignInManager+<TrySignIn>d__10.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskCache.CreateCacheableTask[TResult] (TResult result) [0x00000] in <00000000000000000000000000000000>:0
at SignInManager.TrySignIn (EmailAddress email, Password password, LoginEvents+SignInCallback callback) [0x00000] in <00000000000000000000000000000000>:0
at LoginEvents+SignInEvent.Invoke (EmailAddress email, Password password, LoginEvents+SignInCallback callback) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallback`1[TEventType].Invoke (TEventType evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.PointerEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.SendPositionBasedEvent[TArg] (UnityEngine.Vector3 mousePosition, UnityEngine.Vector3 delta, System.Func`4[T1,T2,T3,TResult] evtFactory, TArg arg) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.SendIMGUIEvents () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.Update () [0x00000] in <00000000000000000000000000000000>:0
Rethrow as TypeInitializationException: The type initializer for 'Amazon.Runtime.Internal.FallbackInternalConfigurationFactory' threw an exception.
at Amazon.Runtime.ClientConfig.get_RetryMode () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.AmazonServiceClient.BuildRuntimePipeline () [0x00000] in <00000000000000000000000000000000>:0
at SignInManager+<TrySignIn>d__10.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskCache.CreateCacheableTask[TResult] (TResult result) [0x00000] in <00000000000000000000000000000000>:0
at SignInManager.TrySignIn (EmailAddress email, Password password, LoginEvents+SignInCallback callback) [0x00000] in <00000000000000000000000000000000>:0
at LoginEvents+SignInEvent.Invoke (EmailAddress email, Password password, LoginEvents+SignInCallback callback) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallback`1[TEventType].Invoke (TEventType evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.PointerEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.SendPositionBasedEvent[TArg] (UnityEngine.Vector3 mousePosition, UnityEngine.Vector3 delta, System.Func`4[T1,T2,T3,TResult] evtFactory, TArg arg) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.SendIMGUIEvents () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UIElements.EventSystem.Update () [0x00000] in <00000000000000000000000000000000>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.SendOrPostCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.UnitySynchronizationContext:Exec()
UnityEngine.UnitySynchronizationContext:Exec()
(Filename: currently not available on il2cpp Line: -1)
所以因为这是一个类型初始化问题,所以我怀疑代码剥离有问题。但是我完全不懂代码剥离,这种预感只是基于我阅读的一些论坛帖子。
任何想法都会非常有帮助。我卡住了。
我用 很多 的难度和扎实的工作周设法解决了这个问题。这是我为修复它所做的步骤。以防以后其他人遇到问题。
- 确保我已经更新了 AWS SDK dll。我在 rider 中用 nuget 得到了这些,然后将 netstandard2.0 dll 拖到插件文件夹中。注意:仔细查看 nuget 中列出的依赖项。我必须使用稍旧版本的 AWS SDK 才能与 cognitoAuthentification.dll. 兼容
这是 rider 中的包的屏幕截图。包版本似乎很重要。仔细检查依赖项。
使用 Amazon.Extensions.CognitoAuthentication.dll 而不是 AWSSDK.Extensions.CognitoAuthentication.dll
删除 link.xml 文件中的所有内容。仅包含以下条目:
<linker> <assembly fullname="AWSSDK.Core"> <type fullname="Amazon.Util.Internal.PlatformServices.NetworkReachability" preserve="all"/> <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/> </assembly> </linker>
检查所有其他插件,并逐一检查排除 iOS。首先,检查它是否破坏了编辑器中的桌面播放。然后检查它是否破坏了 iOS 构建中的任何内容。我认为这可能是最重要的一步。
进入unityeditor.app包内容,往下进入monobleedingedge/unityjit/拖拽Mono.Posix、System.Core、System.Configuration进入我的插件文件夹。
请注意,每次我更改 unity 插件文件夹中的 dll 时,我都必须重新启动 unity 以消除控制台错误和重新加载脚本失败。
如果有人好奇的话,这是我的插件文件夹的截图
无论如何...真正的答案是这不是一个用户友好的系统。