Advertisement
salahzar

TransformCopier.cs

Feb 28th, 2021
892
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. // TransformCopier.cs v 1.2
  2. // homepage: http://wiki.unity3d.com/index.php/CopyTransform
  3.  
  4. using UnityEngine;
  5. using UnityEditor;
  6. using System.Collections;
  7. using System;
  8.  
  9. // da mettersi sotto una cartella Editor sotto Assets
  10. public class TransformCopier : ScriptableObject
  11. {
  12.  
  13.    
  14.     [MenuItem("CONTEXT/Transform/Copy Position to clipboard")]
  15.     private static void CopyTransformToClipboard()
  16.     {
  17.         Debug.Log("Copy position to clipboard");
  18.         Vector3 position = Selection.activeTransform.localPosition;
  19.         //Vector3 rotation = Selection.activeTransform.rotation.eulerAngles;
  20.         string vectorString = String.Format("Vector3({0}f,{1}f,{2}f)", position.x.ToString(), position.y.ToString(), position.z.ToString());
  21.         //vectorString += String.Format(",Vector3({0},{1},{2})", rotation.x.ToString(), rotation.y.ToString(), rotation.z.ToString());
  22.         Debug.Log(String.Format("Copied {0}", vectorString));
  23.         GUIUtility.systemCopyBuffer = vectorString;
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement