I keep getting a null reference exception on the last line. I’m fairly sure the paths are all correct (and I’ve tried many different variations of the path in the actual Resources.Load command), the files are actually there in the right spot, but it doesn’t work. (prefabTypes and levelType are both strings)
DirectoryInfo dir = new DirectoryInfo("Assets\\Resources\\" + levelType);
FileInfo[] info = dir.GetFiles(prefabTypes _+ "*.prefab");_
List newList = new List();
for(int j = 0; j < info.Length; j++)
{
- print(levelType + “\” + info[j].Name);*
- GameObject obj = null;*
- obj = Resources.Load(levelType + “\” + info[j].Name) as GameObject;*
- print(obj);*
- newList.Add(obj);*
}
prefabs.Add(prefabTypes*, newList);*