CopyTransform

From Unify Community Wiki
Revision as of 04:07, 20 October 2006 by DocSWAB (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

C# - CopyTransform.cs

<csharp> using UnityEngine; using UnityEditor; using System.Collections;

public class TransformCopier : ScriptableObject {

       private static Vector3 position;
       private static Quaternion rotation;
       private static Vector3 scale;  
   
   [MenuItem ("Custom/Transform Copier/Copy Selected Transform")]
   static void DoRecord()
   {
      
      position = Selection.activeTransform.localPosition;
      rotation = Selection.activeTransform.localRotation;
      scale = Selection.activeTransform.localScale;       
       
       EditorUtility.DisplayDialog("Transform Copier Copy", "Local Transform Copied Relative to Parent.", "OK", "");
   }

   [MenuItem ("Custom/Transform Copier/Paste Transform")]
   static void DoApply()
   {
        Selection.activeTransform.localPosition = position;
       Selection.activeTransform.localRotation = rotation;
       Selection.activeTransform.localScale = scale;       


       EditorUtility.DisplayDialog("Transform Copier Paste", "Local Transform Pasted Relative to Parent.", "OK", "");
   }

} </csharp>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox