T
T
ThaumicNik2021-04-28 22:14:14
Mobile development
ThaumicNik, 2021-04-28 22:14:14

Why is a NullReferenceException thrown even though the reference is present?

While trying to build an application in Unity, I ran into a problem that the method in the button could not be called. I looked into the logs and found that a NullReference exception was occurring, although there were no problems or errors in the editor. All fields are filled in the inspector (see appendix).
What could be causing this problem? How to solve it?
anNbC6I2uJ4.jpg?size=1915x1039&quality=96&sign=53e7b912a317d72d7660216ebea7ff19&type=album

Full error code:

Spoiler
2021.04.28 21:45:57.457 5204 5225 Error Unity NullReferenceException: Object reference not set to an instance of an object
2021.04.28 21:45:57.457 5204 5225 Error Unity at EventManager.UpdateEventInfo (System.UInt32 eventId) [0x00000] in <0f5c51a7befb438a85e5ed2da1233784>:0
2021.04.28 21:45:57.457 5204 5225 Error Unity at EventManager.StartEvent (System.UInt32 eventId) [0x00000] in <0f5c51a7befb438a85e5ed2da1233784>:0
2021.04.28 21:45:57.457 5204 5225 Error Unity at EventManager.BeginRegularEvent (UnityEngine.GameObject obj) [0x0001f] in <0f5c51a7befb438a85e5ed2da1233784>:0
2021.04.28 21:45:57.457 5204 5225 Error Unity at UnityEngine.Events.InvokableCall`1[T1].Invoke (T1 args0) [0x00010] in <92ee4185062b4e4faf57819494c1d4e0>:0
2021.04.28 21:45:57.457 5204 5225 Error Unity at UnityEngine.Events.CachedInvokableCall`1[T].Invoke (System.Object[] args) [0x00001] in <92ee4185062b4e4faf57819494c1d4e0>:0
2021.04.28 21:45:57.457 5204 5225 Error Unity at UnityEngine.Events.UnityEvent.Invoke () [0x00074] in <92ee4185062b4e4faf57819494c1d4e0>:0
2021.04.28 21:45:57.457 5204 5225 Error Unity at UnityEngine.UI.Button.Press () [0x0001c] in :0
2021.04.28 21:45:57.457 5204 5225 Error Unity at UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00009] in :0
2021.04.28 21:45:57.457 5204 5225 Error Unity at UnityEngine.EventSystems.ExecuteEvents.


EventManager script: https://pastebin.ubuntu.com/p/C2n5wTKzxv

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-04-28
@ThaumicNik

Where is your existence check?EventList[currentEventId]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question