Modifying several gameobjects with an editor script?

How can I change several objects in an scene from one to another? for instance lets suppose I have a ton of spheres and I want to change them all for cubes? and they are different objects? (not the same prefab)

Ok I finally figured this one by myself, so Im posting the answer for those who may be interested.

Short answer: you cant, You cant replace an object that is already on the scene with another, you can fake it, and get a pretty similar result though.

This is what you need to do

1.-Create a new prefab with the objects you want to "convert" from the scene (the cubes) lets call this "the list" 2.-Create another prefab with the final object you want to replace the originals(the sphere) lets call this "proxy" 3.-Now create an editor script that creates a new proxy in all the positions in the list (you can also copy other details like the script, textures etc)

//Select the list prefab in the assets
var SelectedObject:GameObject=Selection.ActiveObject;

//Get the proxy
var proxy:GameObject=Resources.Load("Proxy");

//Select all the transform in the list even if they are not active. 
for (var listObj:Transform in SelectedObject.GetComponentsInChildren(Transform, false){
if (listObj.Transform!=SelectedObject.transform){
   Instantiate(proxy,myTransform.position, myTransform.rotation);
}}

4.-Delete all the original objects from the scene.

Thats it. Is a bit of a laborious task but is better than modifying all objects by hand (specially if you have 800 like me, dont ask)

I hope someone finds this useful.

Just made a blog post about the subject here Batch replace gameobjects in Unity | Zaxis Games Blog