Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

No function to CTRL + D (duplicate) through an editor script?!

Discussion in 'Editor & General Support' started by VatelsRevenge, Aug 22, 2014.

  1. VatelsRevenge

    VatelsRevenge

    Joined:
    Feb 10, 2012
    Posts:
    14
    Please read all of this before commenting.

    First off, I'm needing an Editor Script. This isn't for runtime.

    So, let's say I have a simple GameObject (not a prefab), with a child Fbx Model Prefab (still linked to it's fbx in the project), and I've added a script component to the fbx child ... how do I duplicate that structure in Unity through a SINGLE function?

    upload_2014-8-22_12-41-12.png

    Not looking for a lesson on for loops. Because my actual heirarchy is much more complicated than this. With 1000s of unlinked objects, prefabs, and model-prefabs with added components.

    Simply, I'm looking for an EditorUtility.Duplicate(GameObject go) type function.

    Not Object.Instantiate().
    That will destroy the child fbx's link to the fbx in the project.

    Not PrefabUtility.InstantiatePrefab().
    This only works directly on a prefab. And I have heterogeneous mixture of types. And most of my prefab children have been altered from their project stored state.

    Again, I know I can rebuild the entire structure by using for loops and a combination of PrefabUtility functions and Object functions, but ... why??

    It strikes me a preposterous. But there really doesn't appear to be a simple EditorUtility.Duplicate() function. Just need something to hit "Ctrl + d" through code, lol.

    If this really doesn't exist, can it be added in? I can't imagine this taking too much time. After all its functionality already exists.
     

    Attached Files:

    Last edited: Aug 28, 2014
  2. Tortuap

    Tortuap

    Joined:
    Dec 4, 2013
    Posts:
    99
    UnityEditor.Unsupported.DuplicateGameObjectsUsingPasteboard();
     
unityunity