Index out of range exception

Hey! I’ve just finished the “giving a quest” portion of the lesson, and when I get to completing the dialogue for giving a quest, it’s not populating a new quest, it’s throwing an IndexOUtofRangeException saying that the index was outside the bounds of the array on the PlayerConversant.

IndexOutOfRangeException: Index was outside the bounds of the array.
Sanctuary.Harry.Dialogue.PlayerConversant.Next () (at Assets/Harry/Scripts/Dialogue/PlayerConversant.cs:121)
Sanctuary.Harry.Dialogue.PlayerConversant.SelectChoice (DialogueNode chosenNode) (at Assets/Harry/Scripts/Dialogue/PlayerConversant.cs:104)
Sanctuary.Harry.UI.DialogueUI+<>c__DisplayClass11_0.<BuildChoiceList>b__0 () (at Assets/Harry/Scripts/UI/DialogueUI.cs:69)
UnityEngine.Events.InvokableCall.Invoke () (at <ab7de6937a4448b0a6ccd59e9820599a>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <ab7de6937a4448b0a6ccd59e9820599a>: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)

Another one of my “hey I figured it out somehow” kind of things.

It was because I had the final node in the dialogue as a player response. If it’s a player response, it doesn’t work.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms