UnityNativeEditBox icon indicating copy to clipboard operation
UnityNativeEditBox copied to clipboard

Native Edit Box: creation/destruction of the native field is delayed on one frame

Open Celtcoste opened this issue 3 years ago • 2 comments

Hello !

I'm using the plugin and I noticed that there is a kind of blink when I'm disabling and enabling the native edit boxes. There is below an example, which I took from my app at 3 following frames.

Frame 1: Frame 2: Frame 3:

I'm not using the functionality "Switch Between Native" because there is also a blink when focusing/defocusing the field. I think the delay/blink comes from the native call to Destroy(), that is not handle at the same time as the Unity onDisable() function on the input field.

To fix this issue, I tried to :

  • remove all the delays from scripts (WaitForEndOfFrame/WaitForFixedUpdate) so the native calls can be made the quickest possible
  • Prioritize the plugin script execution order (-800)
  • Drop down the framerate from 60 fps to 30 fps
  • Move the input field out of the canvas before its destruction and show it when it had time to load on the side

I'm currently using Unity 2020.3.0f1. Is there a way to correct this problem in a proper way and avoid this delayed frame ?

Thank you for your help.

Celtcoste avatar Mar 16 '21 20:03 Celtcoste

Hi! Is this on ios or android ? I've never seen the issue, but I'm only using this plugin on a project that is running Unity 2017. The calls to the native code should be directly so in theory there shouldn't be any frame delays... but I do belive you. I'm afraid I don't have a answer right now, but I'm planning on adding this to a Unity 2020 project soon(TM).

nostek avatar Mar 16 '21 21:03 nostek

Thank you for your answer.

It happens on both. I also made the plugin compatible with TextMeshPro input but I’m not sure it’s related.

I did some tests, the delay appears when I am trying to move the native input. Unity elements are disappearing well but there is the one frame difference with native input. Can it be related to the function CoUpdatePlacement?

I also notice when I use a native input inside a scroller, there is also a delay with other Unity UI elements.

Celtcoste avatar Mar 17 '21 12:03 Celtcoste