Unity 在Editor中使用剪切板

来源:互联网 发布:营销视频制作软件 编辑:程序博客网 时间:2024/06/13 22:30

在写unity的编辑器扩展时用到了复制黏贴数据模型的功能,借用了剪切板作为中介,记录一下使用剪切板的方式,全部参考自网上

1.复制到剪切板
TextEditor textEd = new TextEditor();
textEd.text = groupJson;//groupJson为要复制的字符串
textEd.OnFocus();
textEd.Copy();
2.从剪切板得到数据
  string str = GUIUtility.systemCopyBuffer;
        Debug.Log("剪贴板内容:" + str);