Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS WKWebview has delayed inputs when using non-English characters #805

Open
sangpan opened this issue May 12, 2022 · 3 comments
Open

Comments

@sangpan
Copy link

sangpan commented May 12, 2022

this problem reported to Unity.
https://issuetracker.unity3d.com/issues/macos-wkwebview-has-delayed-inputs-when-using-non-english-characters

reproduce Video : https://youtu.be/bSBh88YvSPY

But

They said..

Hi,

Short story: Plugin developer needs to update their code.

Long story: The PR that caused the issue was correcting the Mac player's implementation of the playerloop to fire constantly, instead of using a timer approximate to the frame rate. This meant that the player loop is being fired more quickly (every 0.001 seconds) instead of 0.167s (60fps) which means there is not enough time between loops.

The reason it's different in the editor and player is that they don't share code, and the player code is the more correct of the two.

Therefore, it's down to the plugin maintainer to fix the user's issue.

This particular case has been investigated thoroughly and we have decided, in the interest of protecting the stability and features of Unity for users that rely upon the affected versions, to not address this fix for the time being. We understand that this will cause problems for some users, so we may address this in a future version.

We appreciate your contribution to the Unity product.

tried to belows. But can't resolve.

Anyone with other opinions?

@KojiNakamaru
Copy link
Member

I tried to refine the osx implementation in #806 and updated binaries. It should run more smoothly compared with the last version. Please note, however, the osx implementation is still tricky/experimental and has various limitations about event handling and/or movies. You can find other better solutions on Asset Store (cf. #612 (comment) ).

@sangpan
Copy link
Author

sangpan commented May 17, 2022

Ah osx experimental..
thank you for response.

anyway.. I tried to apply this plugin to UNITY 2019.4.32 ( Run on macOS 12.3.1)

More detailed about what is problem.

I understood this original source logic like below:

  1. make webview object.
  2. draw by update call webview object.
  3. if event from os (keyboard) pass to first unity Update().
  4. pass to webview object.
  5. event process

has some problem.
draw screen speed is normal, but international language input is broken. (IME composition is ignored, ex: Korean, Chinese, or Japanese)

then I tried to fork repository and modify some logic showing webview .

  1. make webview object.
  2. add to mainwindow webview object by addsubview API
  3. if event from os (keyboard) pass to webview directly.
  4. Not need update draw from object or getmessage or other relate with lifecycle.

just showing native webview itself.

But getting slow when try to input internation characters .
and be normal after change to english input mode.

I am looking for resolve or avoid this slow running....

@KojiNakamaru
Copy link
Member

I've tried your approach, i.e., [NSApp.mainWindow.contentView addSubview:webView]. As you reported, Event handling didn't work well. For osx, "unity as a library" is not available so it should require a long time to seek a good solution. If you get any clue, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants