Copying a box collider to a different gameobject?

I’m trying to keep the same box collider among different gameobjects, which all have different sizes. Is there a way to match their box collider sizes without resizing each box collider manually?

I realize I could attach an empty child object containing the box collider to each gameobject, but it would be more elegant to put the collider directly onto the object itself. If it’s possible?

In Unity 4 you can right click on the box collider and select copy component. Then paste it on another selected object as a new component or just paste the values.

If you use Unity 3 there is a tool for that on the asset store.

You could also write a custom editor script to add and adjust your box collider to the selected object.

AddComponent in the manual

Example script to add component

Not really sure to understand your problem.

Did you want to “Copy paste” a component between multiple object?

  • you can use the edior copy paste component tool for that.
  • Right click on the collider you want to copy and “Copy component”
  • Right click on the inspector of the other object and use “Paste component as new” or “paste component values”

Or did you want to “auto update all collider” when you modify one?

  • In that case I think that the best solution is to use a prefab for all your object that need to share the same collider. Just dont forget to use “Apply” after modifying a collider.
  • An other solution is to always multi-select all your object with the collider each time you want to modify it.

Not sure if i answer your question