我在 Unity 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 错误?有什么我不明白的吗?我应该改用什么?