When I click Reset in Inspector the array is created/resized with 4 elements.
But I can’t modify its values. I get the error:
NullReferenceException: Object reference not set to an instance of an object
What am I doing wrong?
[System.Serializable]
public class Product{
public string nombreID;
}
public class Shop : MonoBehaviour {
public Product[] consumibles;
public void Reset(){
consumibles = new Product[4];
consumibles[0].nombreID = "coins_1000";
}
}