sanukin39/UniClipboard

Unity 2019.1.3 issues

Opened this issue · 1 comments

yosun commented

When trying to call SetText the following error always occurs

InvalidOperationException: Collection was modified; enumeration operation may not execute. System.Collections.Generic.HashSet1+Enumerator[T].MoveNext () (at <3e4da02cf86b4fc686ed0ac61bffc210>:0)
UnityEngine.UI.FontUpdateTracker.RebuildForFont (UnityEngine.Font f) (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/FontUpdateTracker.cs:48)
UnityEngine.Font.InvokeTextureRebuilt_Internal (UnityEngine.Font font) (at /Users/builduser/buildslave/unity/build/Modules/TextRendering/TextRendering.bindings.cs:354)
UnityEngine.UI.InputField:set_text(String)`

Once I updated to Unity 2019, uniclipboard broke on Android for me. I did a lot of work trying to make the native calls work in the jar file, but it didn't help. I found a solution though. I rewrote the getText and setText in the uniclipboard for Android to be this. I tested on an android phone and my functionality was back to normal.

public void SetText(string str){
       var textEditor = new TextEditor();
       textEditor.text = str;
       textEditor.SelectAll();
       textEditor.Copy();
   }

   public string GetText(){
     string content = GUIUtility.systemCopyBuffer;
     return content;
   }