Hello! What is the problem?
I get this error: NullReferenceException: Object reference not set to an instance of an object
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[System.Serializable]
public class inventorySlot
{
public int slotID;
}
public class inventoryDisplay : MonoBehaviour {
public GameObject slotPrefab;
public int slotsCount = 36;
public inventorySlot[] slots;
GameObject slotsBody;
private void Awake()
{
slots = new inventorySlot[slotsCount];
}
private void Start()
{
slotsBody = GameObject.Find("SlotsBody");
for(int i = 0; i < slotsCount; i++)
{
Instantiate
slots*.slotID = 1;*
}
}
}