Search Unity

Control-D now renumbers duplicates- anyway to stop it? ( Unity 5)

Discussion in 'Editor & General Support' started by McSwan, Mar 25, 2015.

  1. McSwan

    McSwan

    Joined:
    Nov 21, 2013
    Posts:
    129
    HI,

    I use control-D to duplicate spawners, that have to have the same name.

    ie Spawner

    Duplicating it now makes it
    Spawner 1

    I know I can just rename it, but would prefer a control D that did not rename/renumber.

    Does one exist ?
     
  2. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    AFAIK it doesn't. Don't understand the change either.
     
  3. McSwan

    McSwan

    Joined:
    Nov 21, 2013
    Posts:
    129
    You can select all your renumbered spawns, and then type the name in, then they all have the same name
     
  4. eheimburg

    eheimburg

    Joined:
    Apr 1, 2009
    Posts:
    34
    This change is super annoying and time-wasting, so I wrote a script to do the old behavior. Place this in your Assets/Editor folder and then Ctrl+Shift+D will duplicate the selected object(s) without renaming them, like the old Unity 4 Ctrl+D did.

    Note that I just wrote this code this morning. I've tested it a bunch, but I haven't "lived with it" to see if there are down sides or hidden gotchas... if I find problems I'll update this post.

    Edit: sigh, and I immediately found a scenario where it breaks prefabs: if you duplicate a non-prefab game object that has prefab children, the duplicated children won't be marked as prefabs. Unfortunately I don't have time to try to fix that at the moment. But I guess the code is useful as a starting point! (And depending on your work flow, that scenario may not actually come up for you anyway.)

    Added comment to the source documenting this known issue.
     

    Attached Files:

    Last edited: May 29, 2015
    BrinicleStudio likes this.