Generic T type

So I have a class

public class Alpha<T> : MonoBehaviour {

}

However, Unity doesn’t let me attach the script to the a GameObject, for it thinks the script name has changed.

Although you can’t attach a generic class (as mentioned above), if you inherit from your class and give it a specialization, you can then attach this subclass to an object. So like this:

// GenericClass.cs
// This class can't be attached.
public class GenericClass <T> : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

// SpecializedSubclass.cs
// But this one can.
public class SpecializedSubclass : GenericClass<int> {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

Yep, you can’t attach that because Unity has no idea what the generic parameter would be. You can’t attach behaviours which are generic at the top level because there is no way of specifying T.