天天看點

unity3d:複制選中物體transform資訊到剪切闆

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class SaveTransInfo : EditorWindow
{

    [MenuItem("SaveTransInfo/SaveOriInfoTo #`")]
    static void SaveOriInfoTo()
    {
        GameObject obj = Selection.activeGameObject;
        Transform trans = obj.transform;
        string angles = trans.localEulerAngles.x + "," + trans.localEulerAngles.y + "," + trans.localEulerAngles.z;
        string str = trans.localPosition.x + "," + trans.localPosition.y + "," + trans.localPosition.z + ";" + angles;

        TextEditor te = new TextEditor();
        te.content = new GUIContent(str);
        te.SelectAll();
        te.Copy();
    }
}      

繼續閱讀