Problem reading array in blueprints

I am attempting to read an array that had 4 values in it. Everything was working fine yesterday and now today the array has stopped working and I am getting an error telling me it has accessed none trying to read index -1 from the array. Not sure what’s happened here but we need help ASAP!

You’ll need to show the code… :slight_smile:

Couple of things could have happened.

  1. Array elements are not yet added but you are trying to read from array. Check lifecycle? Where do you add elements, and where do you read from array?
  2. You have called “clear” on Array and you have deleted all the elements
  3. You used “set” to set new array instance
  4. Other various things. It would be much better to show us what you have done and we might be able to help

Here are somescreenshots showing the full error message and the apparent problem area, hope this helps

Better use this resourse to share your code in blueprints instead of screenshots, it’ll be much easier to read it :slight_smile:

Ah, OK, so your “SelectedSubGoalIndex” in CurrentQuest is -1. Which means you still haven’t updated SelectedSubGoalIndex but you are trying to read from SubGoals.

Check when you call On_Switch_Sub_Quest event. Maybe you are calling it to early (before you have updated SelectedSubGoalIndex). What is default value of your SelectedSubGoalIndex? I assume it’s -1. If that’s the case, than you definitely haven’t updated it, but you are trying to read from SubGoals