GameObject instantiation in C# static constructor

Dear all,

i have an unusal question.
How is a C# class beeing read in Unity?
The question occured since there is the possibility in C# to have a static constructior (which is basically called before a class is instanciated).

My idea is to have a class file which is not attached to the scene but instanciates an gameobject on gamestart (like an overview class that administrates some gameobject-instances).
I don’t like the idea of having a gameobject for this on the scene and attach a script to it just for this purpose.

class Overview
{
// Static variable that must be initialized at run time.
static List gos;

// Static constructor is called at most one time, before any
// instance constructor is invoked or member is accessed.
static Overview()
{
	gos = new List<GameObject>();
	//gos.Add(Instanciate(Resources.load(...)));
	//some other instances
}

}

You can do that at editor time using things like InitializeOnLoad. Not sure if you can do that at runtime… It needs somehow to get triggered by an instance on the scene. You could use PostProcessSceneAttribute to create an object before the scene gets built.

You can use classes as always as long as you don’t mix Unity-specific calls with threads as most of them (Instantiate, Coroutines, etc) must be called from the main thread.

What you are trying to achieve should work if you don’t need to use Unity-specific methods in your Overview class.

One little thing, its Instantiate, not Instanciate.