Reputation: 11
I want to make an array that looks like this image but cannot work out how to get for example a gameobject and an int into one element of an array.
Upvotes: 0
Views: 614
Reputation: 729
You can do this by defining a custom class or struct containing multiple serialized fields and adding the Serializable attribute to it.
[Serializable]
public class ElementData
{
public GameObject gameObject;
public int amount;
}
Then you can define an array of this custom class.
public ElementData[] array;
Upvotes: 2