salahzar

TransformCopier.cs

Feb 28th, 2021
725
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×