1. @MenuItem ("Maquette/Batch Rename")
  2. static function BatchRename()
  3. { // Renames all selected items in the Hierarchy to the first item selected, with numbers.
  4. var iname : String;
  5. ispacer = "0";
  6. icount = 0;
  7. iname = Selection.activeGameObject.name; // The item in the inspector
  8.  
  9. istuff = Selection.gameObjects.length; // if I wanted this to support renaming of > 99 objects correctly, I'd use this.
  10.  
  11. for (igo in Selection.gameObjects)
  12. {
  13. icount ++;
  14. if (icount > 9) ispacer = "";
  15. igo.name =iname + "-" + ispacer + icount;
  16. }
  17. }