So I have a DLL with a class ResourceManager implemented as a singleton. The GetInstance() method for the class has the following code..
public static ResourceManager GetInstance()
{
Debug.Log("ResourceManager Inst");
if (cInstance == null) {
GameObject container = new GameObject("ResourceManager");
cInstance = container.AddComponent<ResourceManager>();
}
return cInstance;
}
where cInstance is defined as..
static ResourceManager cInstance;
This is all happening inside a DLL which is placed in the Plugins folder of my Unity project. So when I make the following inside a script in my Unity scene,
ResourceManager.GetInstance().DoSomething();
I get the following error..
"Can't add component because 'ResourceManager' is not derived from Component."
So, is it the case that, this kind of code just will not work because it is in a dll or is there something wrong in the way I have done things here?
NOTE: as of Unity 3.x this is now possible.