【问题标题】:Unity3d UI events not working on iOS deviceUnity3d UI 事件在 iOS 设备上不起作用
【发布时间】:2015-04-28 10:30:43
【问题描述】:

我正在使用 Unity 4.6.4 开发 iOS 和 Android 游戏。我的 UI 内容在 Android 设备上运行良好。但是,在 iOS 设备上,用户界面外观还可以,但无法正常工作。按钮 onClick 事件不起作用,但按钮动画起作用 - 这就是为什么我猜它与 UI 的事件系统有关。

这是我在 Xcode 中的日志:

NotSupportedException: Operation is not supported.

at System.Type.GetGenericArguments () [0x00000] in :0

at System.Type.MakeGenericType (System.Type[] typeArguments) [0x00000] in :0

at UnityEngine.Events.PersistentCall.GetObjectCall (UnityEngine.Object target, System.Reflection.MethodInfo method, UnityEngine.Events.ArgumentCache arguments) [0x00000] in :0

at UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) [0x00000] in :0

at UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) [0x00000] in :0

at UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () [0x00000] in :0

at UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) [0x00000] in :0

at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in :0

at UnityEngine.UI.Button.Press () [0x00000] in :0

at UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in :0

at UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in :0

at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) [0x00000] in :0

你能帮帮我吗?

【问题讨论】:

  • 显示导致该错误的代码。
  • 这不是我可以展示的东西,因为它在我的项目中很常见(正如我所说的它是 UI 的东西,并且项目中有很多 UI 的东西)。关键是代码没问题(它们也是简单的东西,通常在 Inspector 上添加按钮的 OnClick 方法),它在 Android 上正常工作就是一个指标。据我了解,iOS 部分需要某种设置等。

标签: ios unity3d-gui


【解决方案1】:

您应该在 PlayerSettings 中更改“Stripping Level”选项,您最好选择“Disabled”。

【讨论】:

  • 似乎没有禁用选项,至少在 2020.1
猜你喜欢
  • 2012-03-21
  • 2016-09-16
  • 2018-09-20
  • 1970-01-01
  • 1970-01-01
  • 2016-11-29
  • 2020-06-02
  • 2023-01-12
  • 1970-01-01
相关资源
最近更新 更多