corona
corona copied to clipboard
Timing bug in scene transitions
I finally tracked down a bug I've been running into for quite some time.
I first leave a scene with a "swipeLeft", going to a little dummy in-between scene. I then do a "no effect" transition back to the previous scene, albeit with different data. Sometimes on my return I'll only see the new graphics pop in on the left side.[1]
What I believe is happening is that the assumption described in this comment is not completely reliable.
The scene transitions are using transition.to()
under the hood, and gotoScene()
(and scene events) are using timers. What seems to be happening is that the scene group's position is restored to 0, 0, then the "slideLeft" transition finishes and slams it back to the left.
(I noticed, using Runtime.getFrameID()
, that the "will"
and "did"
phases of the "show"
event occurred in the same frame, but I don't know if that speaks to the problem other than how soon the follow-up "no effect" / "crossFade" transition happens.)
In my case, the timing window is pretty narrow, but I could see this showing up with random performance hiccups during scene transitions. (Maybe there are some incidents if I dig around in the forum.)
Rather than the fragile timing, this probably wants some kind of "don't start transition X unless / until transition Y has finished (and die if it's cancelled?)" option.
[1] - ~~In particular, up to 0, with anchorX
equal to 1, i.e. overlapping the left-hand letterbox rect. This is an issue in its own right (z-order not preserved), but without these few bits that did appear I'd have been totally at sea.😄~~ (EDIT: I might be misdiagnosing this part, so disregard. 🙂)