我有統一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()將遊戲/應用內外的剪貼板分開即可。 –