Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Copy-Paste Editor Extension (+ Save changes made during runtime)

Discussion in 'Scripting' started by noamgat, Jan 17, 2011.

  1. noamgat

    noamgat

    Joined:
    Nov 22, 2009
    Posts:
    125
    Hi,

    While the unity editor is a great tool, there are some short-comings when dealing with large amounts of data (for example, GUI layout structures such as rectanges and style objects).
    As part of my work in Omek Interactive, I created a small editor extension that makes these operations much quicker.
    We wanted to give something back to the community, and this has improved our workflow, so we decided to release this.

    To use the extension, put "CopyPasteEditor.cs" in an Editor subdirectory, and add the "CopyPasteComponent" component to an object.
    The newly created component will have the list of all of the members in the GameObject that is being rendered. Each member will have a "Copy" button, and when an object is selected for copying, other members of the same type will have a "Paste" button that will copy the settings between the objects.

    I attached a screenshot of what it looks like. You can also see the "recursion depth" parameter, which allows you to copy nested members or structures as well.

    This script comes with a bonus : it can be used to save changes made during runtime. If you Copy an object when running, the copy will remain alive when the game is stopped, allowing you to paste it (with the changes made during runtime) on top of the original object that had its properties reverted.

    The license is MIT, which should be permissive enough for anything.

    Enjoy!
    Feedback and comments are welcome as always, of course.
     

    Attached Files:

  2. EmadGh

    EmadGh

    Joined:
    Jun 10, 2009
    Posts:
    147
    very good, but I think it was better to post this in showcase.
     
  3. noamgat

    noamgat

    Joined:
    Nov 22, 2009
    Posts:
    125
    Hm... Might be a good idea.
    Admins : If you see this, can you move this to the showcase forums?
     
  4. Lacrymology

    Lacrymology

    Joined:
    Apr 7, 2011
    Posts:
    8
    Sorry, this sounds amazing, but I can´t get it to work.. I have this

    Editor/CopyPasteComponent/CopyPasteEditor.cs
    Standard Assets/CopyPasteComponent/CopyPasteComponent.cs

    and I have a GameObject with a bunch of cubes inside it, and I added the CopyPasteComponent script to both the GameObjects and some of the cubes, and nothing happened.. the CopyPasteComponent in the inspector just has the recursion depth variable, and that´s it. Also tried moving the script out to Assets, didn´t work either.

    What am I doing wrong?