Hello,
I built the Snake Game from this tutorial in WebGL → link . It works correctly.
But when I create application for vk.com like this than the input does not work → link
But If you will press W and will click on scene when the game is loading it sometimes works.
Please, test it . If you in during loading of game will press W and will click on scene it will be working.
I can’t test it because I don’t have a VK account, but, probably this is a known issue, where the WebGL content will not focus the iframe when clicked on it correctly. This will be fixed in an upcoming release (I believe 5.2), but it is also possible to work around it by calling: Application.ExternalCall(“window.focus();”); to force the iframe to be focused.
Thank you! A added in my code:
void Awake ()
{
// Focus on the Frame
Application.ExternalCall("window.focus();");
collisionState = GetComponent<CollisionState>();
animator = GetComponent<Animator>();
inputState = GetComponent<InputState>();
}
But focus on iFrame doesn’t set. I will use Web Player and I will wait 5.2.
Oh, sorry - it should be ExternalEval, not ExternalCall.
I replaced ExternalCall on ExternalEval but focus doesn’t set on iFrame for WebGL again.
I see in documentation that ExternalEval is for Web Player only.
You can test another problems. It is direct links on my apps (not VK)
Super Mario 2D (Web Player)
Super Mario 2D (WebGL)
I set Fastest (very slow builds) option for WebGL. You can see problems with freezing and sounds. Is it because WebGL in Unity is in Preview version?
When I add ExternalEval to WebGL apps I receive this message:
I save the console information in the log file.
Now you can test my apps above.
2269116–152052–log.txt (3.29 KB)
Application.ExternalEval is actually supported on WebGL. We just need to update the docs.
The audio is indeed a bit strange… could you please submit a bug report ?
I submited a bug report about Application.ExternalEval (in documentation) and about audio bug in WebGL.
The problem with keyboard focus (in iFrame) was solved in 5.2. Thank you very much!
But the game is freezing a little if you will compare with WebPlayer version. I see that the game looks better in WebPlayer. I hope it will be solved it next versions of Unity WebGL:
8Observer8:
The problem with keyboard focus (in iFrame) was solved in 5.2. Thank you very much!
But the game is freezing a little if you will compare with WebPlayer version. I see that the game looks better in WebPlayer. I hope it will be solved it next versions of Unity WebGL:
what do you mean by “freezing” ?
I mean that the objects are moving more smoothly in WebPlayer