Answer the question
In order to leave comments, you need to log in
Object reference not set to an instance of an Object Why is unity throwing this error?
public void Awake()
{
sv = JsonUtility.FromJson<Save>(PlayerPrefs.GetString("SV"));
Debug.Log(sv.achieveStatus.Length);
}
public void OnApplicationQuit()
{
sv.achieveStatus = new byte[11, 3];
PlayerPrefs.SetString("SV", JsonUtility.ToJson(sv));
PlayerPrefs.Save();
}
Answer the question
In order to leave comments, you need to log in
did you forget to initialize the array somewhere?
if other variables and fields from sv are available..
sv.achieveStatus = new int[,]
or not int. but you get the gist.
otherwise you will get NUllRef)) you can’t take the length from ANYTHING))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question