Improved clipboard copy/paste

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.
28 Likes

In order to copy values from the Inspector to insert in code, it would be useful to add a “f” to indicate it’s a float. So rather than:
Color(0.1,3,4,1)
it would be:
Color(0.1f,3,4,1)

This is now possible?
https://forum.unity.com/threads/allow-to-paste-color-values-from-external-applications.738845/

5 Likes

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 !

1 Like

Sounds like what you really want is a “save playmode changes” feature? :slight_smile:

3 Likes

Yes, as long as clipboard contents is one of: #RGB, #RRGGBB, #RGBA, #RRGGBBAA or “Color(r,g,b,a)”

2 Likes

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 :slight_smile:

1 Like

Oh wow, this finally happened :smile: 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! :slight_smile:

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.

Are we supposed to take that as a hint? :wink:

That apply button should be there :slight_smile: 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 :smile:

ScriptableObjects getting more commonly used have also helped a lot.

I love this so much. Thanks!

Cheeky request 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.

4 Likes

On the list, but not related to copy/paste!

3 Likes

While on this subject, any hint of copy/cut/paste of files in the project window? :slight_smile: Moving a a file from folder A to folder B in big projects is quite a bit of effort currently

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)

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.

On the topic of copy/paste, any chance copy/paste was added to the Assets (e.g. Prefabs, Materials, etc…)?

Would love to be able to copy an entire game object hierarchy from one project to another with a simple CTR+C, CTR+V

1 Like

@Aras , I’d like to right click here to paste components, rather than on the tiny vertical ellipsis.

10 Likes

Most GameObjects in my projects have Components attached, there is no free space to right-click in most cases, unless you search for it.

What I think should be supported is to paste Components with the Ctrl+V shortcut. If you copied a Component, select another GameObject and press Ctrl+V, it should paste the Component to the selected GameObject. “Paste values” if a the same Component exists on the target GO already, or add the Component if it does not exist yet.

This would allow to paste a Component without having to scroll down in the inspector to find the free space at the bottom to right-click and choose “Paste” in the context-menu.

PS: You don’t have to click the vertical ellipsis button, you can also right-click on any Component header.

3 Likes

Why be humble about it:

I’m all in favour about being able to right click on the empty space, but also next to the add component button and really wherever.

Just let me throw my mouse over there and go “paste” and not have to aim would be A+++. Might be usability stuff I haven’t thought about, but copy-pasting is great and having to aim to do it is lame.

4 Likes