Unity 获取系统剪切板中的内容方法(Ctrl + V)

Unity 获取系统剪切板中的内容方法(CtrlV) 方法1: string strGUIUtility.systemCopyBuffer;Debug.Log(

Unity 获取系统剪切板中的内容方法(Ctrl + V)

方法1:

string str = GUIUtility.systemCopyBuffer;
Debug.Log(str);

方法2:
需要导入外部库

using System.Windows.Forms;
如何使用这个外部库,百度有很多使用方法
下面上代码

IDataObject iData = Clipboard.GetDataObject();
Debug.Log((string)iData.GetData(DataFormats.Text));

顺带附上Unity获取ctrl + V的案件监听(组合按键)

private bool keydown;
public void Update() {
   if (Input.GetKeyDown(KeyCode.LeftControl)) {
        keydown = true;
    }
    if (keydown) {
        if (Input.GetKeyDown(KeyCode.V)) {
            Debug.Log("ctrl + V");
            keydown = false;
        }
    }
}

发布者:admin,转转请注明出处:http://www.yc00.com/web/1741228886a4330037.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信