Hello,
I have followed the Hack and Slash tutorials by BurgZergArcade successfully up to number 30 (Or half way through it at least). At 4:34 on the video, when i try to save the vitals, unity says that I have a StackOverflowException. I am pretty sure from Google searches that this means I have an infinite loop of some kind, but I can't find where it is in my code and I can't find anyone else who has had the same problem.
I am quite new to using CSharp in Unity and I was hoping that the tutorials would help me to improve, so it would be a great hep to me if someone could help me out.
This is my code for saving the vitals:
for(int cnt = 0; cnt < Enum.GetValues(typeof(VitalName)).Length; cnt++) {
PlayerPrefs.SetInt(((VitalName)cnt).ToString() + " - Base Value", pcClass.GetVital(cnt).BaseValue);
PlayerPrefs.SetInt(((VitalName)cnt).ToString() + " - Exp To Level", pcClass.GetVital(cnt).ExpToLevel);
PlayerPrefs.SetInt(((VitalName)cnt).ToString() + " - Cur Value", pcClass.GetVital(cnt).CurValue);
}
Thanks,
Dan205
↧