我有统一5.6在Windows(VS2017社区)这个片段:读取和写入剪贴板
public static void setClipboardStr(string str)
{
try
{
if (Clipboard.ContainsText())
{
// ...doesn't matter if true or false -
// from here on, I can't copy+paste inside
// the game or outside until I close the app.
// If I had an error instead of try/catch or
// check if it contains text, the error will
// remain UNTIL I REBOOT (beyond the app closing).
}
}
catch(Exception ex)
{
Debug.LogError(ex);
}
}
每当我检查,如果是文字或没有时,使用剪贴板以任何形式,甚至,它破坏了剪贴板,直到我关闭应用程序。现在,这是一个Unity错误吗? VS错误?有什么我不明白的吗?我应该用什么,而不是?
为什么downvote我的帖子,甚至没有评论?这非常懦弱。这是一个合法的问题 - 如果剪贴板包含图像,只需使用Clipboard.ContainsText()将游戏/应用内外的剪贴板分开即可。 –