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

Canvas dont update immediately after receive message from webview #1118

Open
DoNotChoke opened this issue Nov 28, 2024 · 4 comments
Open

Canvas dont update immediately after receive message from webview #1118

DoNotChoke opened this issue Nov 28, 2024 · 4 comments

Comments

@DoNotChoke
Copy link

I have this code : cb: (msg) =>
{
Debug.Log(string.Format("CallFromJS[{0}]", msg));
isReceived = true;
status.text = msg;
square.GetComponent().material.color = Color.red;
},. However after receive message from webview, only Debug.Log works, canvas and gameobject only work after i click on screen again. I want to modify canvas immediately after webview send message. Anyone has solution?

@Volko61
Copy link
Contributor

Volko61 commented Nov 28, 2024

What canvas and gameObject are you talking about ? i don't see them in the code you gave
Did you tried with the sample project ?

@DoNotChoke
Copy link
Author

Sorry for missing, canvas is status and gameobject is square. I want they react when receive message from webview by (status.text = msg;
square.GetComponent().material.color = Color.red;) however they dont change as i want until i click the screen again. I try Canvas.ForceUpdateCanvases() but it dont work

@Volko61
Copy link
Contributor

Volko61 commented Nov 28, 2024

The issue should be more relative to Unity than to the Webview if the Debug.Log is triggered.

@KojiNakamaru
Copy link
Member

I guess you utilize the WebGL version. The implementation is based on iframe so focusing may become an issue. Please try to set Run In Background in Project Settings/Player/Resolution and Presentation.

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

3 participants