I am writing a script for loading resources I need when starting the scene.
I am trying to use Resources.LoadAll and then make the array as static variable
so that I could use them in other scripts.
using UnityEngine;
using System.Collections;
public class ResourceManager : MonoBehaviour {
public static GameObject[] buff;
public static GameObject[] orelist;
public static GameObject[] terrainlist;
public static GameObject[] playerlist;
public static Sprite[] playerSprite;
void Awake () {
buff = Resources.LoadAll<GameObject>("Buff");
orelist = Resources.LoadAll<GameObject>("OreTile");
terrainlist = Resources.LoadAll<GameObject>("TerrainTile");
playerlist = Resources.LoadAll<GameObject> ("Player");
playerSprite = Resources.LoadAll<Sprite>("Sprite_Player");
}
}
and then about 10 errors similar to this pop up:
I have been searching for solutions for some days but I have no clue what I did wrong.
Please help if you get any ideas!