how to reset a component by code

how to reset a component by code

EditorOnly is ok

Could you elaborate, please?

I put the model made with 3dmax into the scene.This model has a lot of child nodes, and none of them have mesh collider , some child nodes have camera component , so I am written a editor extension to destroy all cameras and add a mesh collider to each mesh renderers , if the mesh collider already exist , reset it.