Hi
I am getting this error “NullReferenceException: Object reference not set to an instance of an object” with this code. And I really cant see what I am doing wrong?
using UnityEngine;
using System.Collections;
public class PrefabLibrary : MonoBehaviour
{
public PrefabSettings[] prefabSettings;
public enum idPrefab
{
Storage,
DefenceTurret,
Engineering,
RecyclePlant,
WaterPlant,
BioDome,
Corridor,
Barracks,
ScienceLab,
LaunchPad,
RocketSilo,
PowerPlant
}
void Start()
{
prefabSettings = new PrefabSettings[30];
prefabSettings[1].obj = null;
}
}
public class PrefabSettings
{
public GameObject obj;
public int id;
}