I would like to create an array that contains a GameObject and a corresponding float.
I am trying to give each enemy the ability to drop an item when they die. That item will be one of the GameObjects and the float is the probability it will be dropped.
So I created this Class:
public class ItemToDrop : MonoBehaviour {
public GameObject itemToDrop;
public float probability;
}
And tried using it in my Enemy class:
[SerializeField]
private List<ItemToDrop> items;
I also tried just doing
Hastable<GameObject, float> items;
but it doesn't like being told what objects it should hold.
But that doesn't work. I tried ArrayList etc..
Is there a way to create a List, Hashtable (or other container) in this fashion?
