EDITOR only one script of a specific type by GameObject

Hello :slight_smile:

Sometimes when you add a native (unity) component to a GameObject you can’t add two of the same type (ex : BoxCollider).

Is it possible to have the same behavior with custom script ?

Thanks !

The attribute DisallowMultipleComponent was just added in 4.5:

Introduced DisallowMultipleComponentAttribute for disallowing multiple components of the same type being added to a single GameObject.

[DisallowMultipleComponent]
public class Script : MonoBehaviour {
 
}