Can I resethreset the [DisallowMultipleComponent]
attribute in child classes in Unity somehow?
I want to create my base class:
[DisallowMultipleComponent]
public class MyCompanyClass : Monobehaviour {}
I want all my component scripts to inherit from the MyCompanyClass
. So, I will be able to add only one instance of my component script to a game object at a time. I need it for most of my classes. But for some classes I still want to preserve the ability to add a few class instances to a game object, while still inheriting from the MyCompanyClass
(because I am going to put some custom behavior into it, which is going to be used by all my component scripts).
So, I was trying to search for something like [AllowMultipleComponent]
, but found nothing. Is there maybe another way to achieve what I want?