Search Unity

  1. Curious about what's going to be in 2020.1? Have a look at the 2020.1 beta blog post.
    Dismiss Notice
  2. Want to see 2020.1b in action? Sign up for our Beta 2020.1 Overview Webinar on April 20th for a live presentation from our evangelists and a Q&A session with guests from R&D.
    Dismiss Notice
  3. Interested in giving us feedback? Join our online research interviews on a broad range of topics and share your insights with us.
    Dismiss Notice
  4. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Improved clipboard copy/paste

Discussion in '2020.1 Beta' started by Aras, Feb 24, 2020.

  1. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,568
    Since 2020.1 alpha 23 there is this release notes item: "Editor: Added Copy/Paste support for most inspector fields (vectors, colors, object references, gradients, animation curves ...). All they produce text in system clipboard, and the copied values can be sent to someone else or pasted into another Unity instance." Here's a bit more about it.

    Added Copy/Paste keyboard shortcuts and context menus to Serialized Property fields (e.g. in Inspector, or anywhere else they are displayed) for most types. This is: Vector2, Vector3, Vector4, Quaternion, Color, Object Reference, Gradient, Animation Curve, Rect, Bounds, LayerMask, Enum, Bool, RectInt, Vector2Int, Vector3Int.


    All these produce text-based representation in the system Clipboard, so you can send that to someone else on a chat, or paste into a text document, or into another Unity instance, etc. Examples of text representations produced by copying simple fields:

    Vector3(10,11,12)
    Vector3(60.0,30.0,45.0)
    Quaternion(0.531975687,0.0222599953,0.200562119,0.822363079)
    #ACFF04
    Color(0.1,3,4,1)
    Bounds(1,-2.5,3.7,1.5,-2,7.7)



    More complex ones are copied/pasted from a TypePrefix:JSON format, for example an animation curve:
    UnityEditor.AnimationCurveWrapperJSON:{"curve":{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.016666412353515626,"value":0.660369873046875,"inSlope":2.0,"outSlope":2.0,"tangentMode":0,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":0,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}}

    Some fields have slightly more specialized context menus, e.g. Quaternion fields can copy either euler angles, or the raw quaternion:


    Or an object reference field can also copy path or the GUID:


    Scene view camera window menu can now copy/paste the camera placement (position+rotation), and the settings themselves. And again that produces just a text in clipboard, so you can send that off to someone else and they can paste into their own scene view.


    In the Animation Window, animation events can also be copied/pasted, either via keyboard shortcuts or the context menus:


    The same is for the animation clip editor in the model import settings events part:




    Let us know what you think!




    Note: a bunch of possible clipboard improvements are not made yet, for example:
    • C# APIs to copy/paste typed things into Clipboard from code,
    • Support for more SerializedProperty field types (custom structs/classes, arrays, ...)
    • Change "Copy Component" and friends to also produce text-based data in system clipboard, so you could paste that into another Unity instance, send to someone, etc.
    • Look into a hundred other places in the editor, where Copy/Paste would be needed, and add that there.
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,642
    Deozaan, hippocoder, mh114 and 2 others like this.
  3. Jichaels

    Jichaels

    Joined:
    Dec 27, 2018
    Posts:
    227
    That's cool, thanks !
    One thing that would be really useful (I almost need it every day I'm working in Unity) is to be able to copy/paste every value of every component attached to a gameObject. (Right now you can only do it for one component :()

    Use case is, for example, trying things (mostly UI) in playmode, when you get the desired result -> right click the gameObject -> "Copy components values" -> stop playmode -> Paste

    That would be neat !
     
    DoctorShinobi likes this.
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,568
    Sounds like what you really want is a "save playmode changes" feature? :)
     
    Lars-Steenhoff, transat and Ofx360 like this.
  5. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,568
    Yes, as long as clipboard contents is one of: #RGB, #RRGGBB, #RGBA, #RRGGBBAA or "Color(r,g,b,a)"
     
    Peter77 and DoctorShinobi like this.
  6. Jichaels

    Jichaels

    Joined:
    Dec 27, 2018
    Posts:
    227
    Not necessarily, but it would be useful too ! Being able to copy an object (you actually can do that already by creating a prefab within playmode, then unpack it after) with two clicks would be great :)
     
    Kingblade likes this.
  7. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,424
    Oh wow, this finally happened :D This has been easily my top editor annoyances for years and have many times hoped Unity would implement this (can't remember how many times I've asked about this in past).

    Thank you! :)
     
  8. jbergs

    jbergs

    Joined:
    Feb 13, 2014
    Posts:
    12
    Not sure if this is part of this system but the ability to Cut/Paste keys in the Animation window and Timeline window would be awesome. I spend lots and lots of time copying > pasting > then deleting old keys.
     
  9. frarf

    frarf

    Joined:
    Nov 23, 2017
    Posts:
    23
    Are we supposed to take that as a hint? ;)
     
  10. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,424
    That apply button should be there :) like just have a way to apply the changes before you exit playmode. The copy / paste setup helps but it's tedious.

    This is something people have always struggled with Unity. In Unity 4 I worked around the lack of copy/paste by just dragging a prefab from gameobject while the game was running and then swapped the GO with the prefab once stopped the play in the editor :D

    ScriptableObjects getting more commonly used have also helped a lot.
     
  11. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,457
    I love this so much. Thanks!

    Btw when you get a chance (I know this is cheeky) but a major, major quality of life thing I added was having a back and forward shortcut. This is the same in visual studio or your browser, it would be such an instinctive and phenomenal navigation tool when you're object hopping around the project window.
     
    Arathorn_J, Peter77 and SugoiDev like this.
  12. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,568
    On the list, but not related to copy/paste!
     
    hippocoder likes this.
  13. SirIntruder

    SirIntruder

    Joined:
    Aug 16, 2013
    Posts:
    41
    While on this subject, any hint of copy/cut/paste of files in the project window? :) Moving a a file from folder A to folder B in big projects is quite a bit of effort currently
     
  14. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,457
    I did try using the new Properties (context menu) feature to get a folder and not just an object in focus but it didn't work. Perhaps it could be expanded? right click a target folder and you get a neat project window pop with the top level being that folder.

    Seems slightly unusual but no less useful.

    (for now you could bookmark a folder and drag something in there - at least in theory that would work)
     
  15. SirIntruder

    SirIntruder

    Joined:
    Aug 16, 2013
    Posts:
    41
    yeah, I could also open an another project window and lock it. But in all cases I need to awkwardly navigate back and forth, instead of cut -> go to destination folder -> paste.
     
  16. HonorableDaniel

    HonorableDaniel

    Joined:
    Feb 28, 2007
    Posts:
    2,915
    On the topic of copy/paste, any chance copy/paste was added to the Assets (e.g. Prefabs, Materials, etc...)?
     
  17. Kingblade

    Kingblade

    Joined:
    Jan 15, 2014
    Posts:
    6
    Would love to be able to copy an entire game object hierarchy from one project to another with a simple CTR+C, CTR+V
     
    transat likes this.
unityunity