Skip to content

Commit

Permalink
fix TransformEditor PastFromClipboard()
Browse files Browse the repository at this point in the history
  • Loading branch information
oleghcp committed Apr 30, 2024
1 parent 172d90a commit e453d15
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
19 changes: 7 additions & 12 deletions Code/Editor/Inspectors/TransformEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,14 @@ private static void CopyToClipboard(MenuCommand command)
[MenuItem(MenuItemsUtility.CONTEXT_MENU_NAME + nameof(Transform) + "/Paste Values from Clipboard (ext.)")]
private static void PastFromClipboard(MenuCommand command)
{
using (SerializedObject serializedObject = new SerializedObject(command.context))
try
{
using (SerializedProperty orderProp = serializedObject.FindProperty("m_RootOrder"))
{
int rootOrder = orderProp.intValue;

Undo.RecordObject(command.context, "Paste Values from Clipboard");
EditorJsonUtility.FromJsonOverwrite(GUIUtility.systemCopyBuffer, command.context);

serializedObject.Update();
orderProp.intValue = rootOrder;
serializedObject.ApplyModifiedPropertiesWithoutUndo();
}
Undo.RecordObject(command.context, "Paste Values from Clipboard");
EditorJsonUtility.FromJsonOverwrite(GUIUtility.systemCopyBuffer, command.context);
}
catch (ArgumentException e)
{
Debug.LogWarning(e.Message);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Oleg Pulkin",
"email": "oleghcp@gmail.com"
},
"version": "2.2.10",
"version": "2.2.11",
"unity": "2019.4",
"description": "A set of helpful code stuff for Unity.",
"keywords": [ "oleghcp", "oleg", "hcp", "unitytools", "tools" ],
Expand Down

0 comments on commit e453d15

Please sign in to comment.