Fix: I had a save file of the list that I would load in when the game started, that’s why I couldn’t change the list.
I have a list of the players best scores for my game. There was 3 floats in it but I needed another, so I added another, but I got a null reference error when I tried to get the fourth in the list. So I tried logging how many items were in it and it said 3. So I tried adding another, and it still said the same thing.
Here’s the script that contains the list.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerManager : MonoBehaviour
{
public static List<float> personalBests = new List<float> {0, 0, 0, 0, 0};
}