Why is there a limitation on [RequireComponent] and is there anyway to increase this? Obviously using it in one of the required components is a method but in some cases I don’t want that.
I think you should be able to increase that limit by simply using multiple RequireComponent attributes like so:
[RequireComponent(typeof(Foo1))]
[RequireComponent(typeof(Foo2))]
[RequireComponent(typeof(Foo3))]
[RequireComponent(typeof(Foo4))]
class Bar : MonoBehaviour
{
.
.
.
}
As to why just three arguments in the constructor, I imagine writing multiple constructors that take more arguments gets tedious after a while, and I personally never had to use more than three in my own code. Though even when I do, I place each type in its own RequreComponent attribute on a separate line.
1 Like
I didn’t need more than 3 before either. Anyway, your method works fine, thanks.