I’m trying to use the Toolbox Singleton implementation you can find here: http://wiki.unity3d.com/index.php/Toolbox
From my main game controller I’m trying to register my map loader component in the following way:
using UnityEngine;
using System.Collections;
public class MainGameController : MonoBehaviour {
void Awake(){
Screen.SetResolution (Screen.height, Screen.width, true);
MapLoader mLoader = Toolbox.Instance.RegisterComponent<MapLoader>();
}
}
But in the console window of unity I get the following compile error:
Assets/Scripts/MainGameController.cs(11,54):
error CS0176: Static member
`Toolbox.RegisterComponent()’ cannot
be accessed with an instance
reference, qualify it with a type name
instead
I’m not really experienced with unity game dev nor with C# generics, so I can’t find what I’m doing wrong.
This is the map loader class
using UnityEngine;
using System.Collections;
[System.Serializable]
public class MapLoader {
private ArrayList tilesInstances = new ArrayList();
public ArrayList TilesInstances
{
get { return tilesInstances; }
}
private void LoadMap()
{
//Do some stuff
}
}