Labels for components?
I'm going through the unity tutorials at the moment.
I noticed the pattern/practice of adding multiple copies of the same component, especially with AudioSource. (ie, one for music, one for sound effects)
Was wondering if there is a way to label/name multiple components of the same type?
From the Inspector, it could be hard to know:
when collapsed, what each component is used for
which component is referenced in a public field
I can see this becoming a potential problem as a project grows in size and complexity.
Thanks
for example:
Answer by FortisVenaliter · Sep 28, 2017 at 07:49 PM
Not that I'm aware of. To mitigate the problems with that, my best practice is to not put more than one component of a type on a single object. What you can do instead is make them their own gameobjects that are children of the current object. Then you can name those objects appropriately. This also makes it much easier to assign these to fields in the inspector.
There is technically a performance hit for using additional transforms, but unless you're doing something crazy, it should be pretty minimal.
Thanks for the answer. Was thinking about using different game objects myself. Just wasn't sure if it was a good practice, as most official tutorials appear to use multiple components on the same GameObject.