Hello, I’ve been struggling several days to make a proper save file for my game.
The player will take care of different animals with different values, so I’m trying to make a save file with the values of each animal store in arrays, but when storing the values I get the error "
IndexOutOfRangeException: Index was outside the bounds of the array.
Player.DataToSave () (at Assets/Scrips/DataManagement/Player.cs:98)"
That line 98 is the identity but I do not know the meaning of it. I chosed this way of storing data because there could be 1 animal or there could be 10. I really dont know what to do. I say brackeys tutorial but it wasnt really that helpful
```csharp
-
Bopongi allBopongi = GameObject.FindObjectsOfType();
for(int i = 0; i < allBopongi.Length; i++) { identity[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().identity; max_Hp[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().maxHealth; hp[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().health; exp[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().experience; expToLevel[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().expToNextLevel; bopongi_lvl[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().bopongiLevel; attackP[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().attackP; unconcernedExp[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().unconcernedExp; displayExpToLvl[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().displayExpToLevel; displayExp[i] = allBopongi[i].gameObject.GetComponent<Bopongi>().displayExp; }*
```