3 ms·
Unfortunately no. IIRC, all "RequireComponent" does is allow you to omit the "add(object, B)" when you "add(object, A)". A simple example of this is when you
by linkdd 6y ago
Unfortunately no.
IIRC, all "RequireComponent" does is allow you to omit the "add(object, B)" when you "add(object, A)".
A simple example of this is when you add A to the object, then edit A to require B. The Unity Editor won't add B automatically (which is in fact a pain).
NB: removing A will not remove B, and B won't be replaced if it existed before.
I usually use "RequireComponent" whenever I have a "GetComponent<...>()" in my behaviour just to make sure I have an initialized value.