function returns an arraylist

I’m trying to kill two birds with one stone. I have a function that assigns attribute variables from PlayerPrefs and adds them to an arraylist. The compiler wants a data type to return, but using arraylist isn’t working. What should I use?

ArrayList LoadAttributes(){
ArrayList myAttributes =new ArrayList();
myAttributes.Add(Constitution=PlayerPrefs.GetInt(“Constitution”,_constitution));
myAttributes.Add(Strength=PlayerPrefs.GetInt(“Strength”, _strength));
myAttributes.Add(Stamina=PlayerPrefs.GetInt(“Stamina:”, _stamina));
myAttributes.Add(Dexterity=PlayerPrefs.GetInt(“Dexterity:”, _dexterity));
myAttributes.Add(Intelligence=PlayerPrefs.GetInt(“Intelligence:”, _intelligence));
myAttributes.Add(Wisdom=PlayerPrefs.GetInt(“Wisdom:”,_wisdom));
myAttributes.Add(Focus=PlayerPrefs.GetInt(“Focus:”,_focus));
myAttributes.Add(Speed=PlayerPrefs.GetFloat(“Speed:”, _speed));
return myAttributes();

Thanks!

don’t know much about arraylists, but it looks like you are basically assembling an int array, with a set length. can’t you just use a normal array, an array of floats should be far more performance-friendly than an ArrayList, I think…

Or on second thought, you could create a struct that contains all the variables you need, then instance one of those. That’s what I would do:

public struct playerStats
{
public int constitution;
//etc....

}

playerStats LoadAttributes()
{
playerStats player = new playerStats();
player.constitution = //etc....
return player;
}

If I’m missing something, I apologize…