Iframe related update issue

I have a couple of projects that have recently - in the past 2 or 3 weeks - started behaving oddly. I hope someone can shed some light on what’s going on. Maybe it was a change to the engine?

The projects are of the same form. They are a PlayCanvas scene inside an iframe ‘wrapper’. The 2 communicate, so that button-clicks in one can generate the appropriate response in the other. So, a click on a button in the wrapper can generate an event that causes the PlayCanvas scene to “react” in some way, including a “fade opacity” camera transition as I move the camera. I’ve been using this code since the Spring with no issues.

Lately, I’ve been seeing the following: when the user clicks a button in the iframe wrapper, the camera transition will begin, but immediately halt. It’s as if the Update functions are no longer being serviced. Oddly enough, mouse-enter/exit events are still being processed, even though (it seems) Updates are not. Also, Updates resume as soon as the user clicks anywhere in the scene…but not UNTIL then.

Specifically, these camera transitions work fine until:

  1. the user clicks in the scene (on a button, or to pivot the camera, for example), then
  2. the user clicks a button in the iframe wrapper.

It’s as if changing (receiving, then losing) focus now halts updates in PlayCanvas. Could this be the case? Can I have it work the way it did a few weeks ago?

There’s nothing specific that we’ve done as far as I know that would prevent this.

Would it be possible to post this prototype/a small public project that showcases this issue?

There could be browser updates that change focus behaviour :thinking:

Well, the problem does not seem to present itself when I’m JUST using the PC scene by itself. It only occurs when the user interacts with the ‘wrapper’ buttons…which, of course, I can’t test in the stand-alone scene.

Ok, so I was able to generate the same issue within the stand-alone scene, by hitting Alt-D (to change focus to the address bar) during a camera transition. So, now I’m pretty confident that this issue is caused by the loss of focus by PlayCanvas.

So, it seems like I either need to:
a) detect the loss of focus and ‘refuse’, or
b) return the focus back to the scene after a button-press in the wrapper.

Unfortunately, I don’t know how to do either of those options. Perhaps there is a tutorial scene that handles one of these issues?

Can you post an example of one of these camera transition please?

The way that you are doing the transition may matter

I can’t replicate the issue on my Chrome browser, Windows 10 laptop and this project where the camera is being moved via the update function: https://playcanv.as/b/hgEq4Zxx/

I am also unable to replicate the issue (even using Alt-D) in older projects (of my own, or the one linked above), even though they use the same code, and I’m using the same browser (Chrome). It seems only to be an issue with newly generated projects. That’s why I thought there might have been a recent change to the PC engine that would have this effect.

Found the issue, in the project code you DM’ed me, timescale is set to 0 in an onBlur event. I will DM you game code.

Just for reference, the build I posted above is with the most recent version of engine.

Thanks, yaostar! This was a big help. That issue had been plaguing me for a few weeks. I had to ship a project without that transition code, just to work around it.