Search Unity

Editor Script to give multiple selected GameOjects unique names.

Discussion in 'Scripting' started by Crazy Robot, Apr 21, 2014.

  1. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    So I needed to change about 100 or so GameObjects in my scenes to different unique names.

    Example:

    FROM:

    GameObject
    GameObject
    GameObject
    GameObject

    TO:

    Pickup1
    Pickup2
    Pickup3
    Pickup4

    But I had over 100 gameobjects instead of just 4.

    So I created a small editor script to help out.

    To use just
    1) Put this into your "Editor" folder.
    2) Use the Menu and bring up the editor window under "GameObject/Change Name"
    3) Enter the name you want your gameobjects to have
    4) Enter the number you want to start with.
    5) Select all the GameObjects you want to change then name of.
    6) Hit "Apply name" button.

    That's all.
    This will change all of your selected gameobject names to a name with a number at the end and it will increment the number so each gameobject will have it's own unique name.

    Hope this helps you as much as it helps me.
     

    Attached Files:

    IgorAherne likes this.