Is it possible to ling a Box Collider to a certain asset so that any new copies of that asset I drag in the scene will have the Box Collider and any existing ones will get one if they don’t have one already? Adding one to every single one would take ages to do.
Casiell
2
That’s what prefabs are for. You create an object, give it whatever components you want and make it a prefab (by draging it to your project window). The you just drag it to hierarchy to create new objects with all the components/values that your prefab has. You can also instantiate it on runtime from code.
Sadly, if you already have bunch of objects, I don’t know if you can link them to a prefab, but for new ones you should really use it, it speeds up work a lot.
If you have a bunch of objects already, you can select them all and add a Collider, it will add it to all selected objects.
Another fun thing is for creating custom classes. You can tag your MonoBahaviour class with RequireComponent tag and this will ensure that every time you add your script to an object, required component will be added as well! It will also prevent you from deleting the required component