IndexOutOfRangeException: Index was outside the bounds of the array.
MainUIController.Pause () (at Assets/script/MainUIController.cs:87)
UnityEngine.Events.InvokableCall.Invoke () (at <531e906a5d9447dca62c95ab61ff1c26>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <531e906a5d9447dca62c95ab61ff1c26>:0)
UnityEngine.UI.Button.Press () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:70)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:114)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:57)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)
就是` MainUIController.Pause () ` 这个方法里面使用的数组越界了。打断点或者添加日志看下,访问的索引是否包含在其中。还有个误区是访问索引不是int类型的。
数组越界吧,你仔细检查下数组代码的获取