Skip to content

Commit 6a2397b

Browse files
committed
The Clock.now property value is now synced to be the TimeStep.time value when the Clock plugin boots and is no longer Date.now() until the first update
1 parent ab2f489 commit 6a2397b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Notes:
6767
* The `PluginManager.installScenePlugin` method has a new optional boolean parameter `fromLoader` which controls if the plugin is coming in from the result of a Loader operation or not. If it is, it no longer throws a console warning if the plugin already exists. This fixes an issue where if you return to a Scene that loads a Scene Plugin it would throw a warning and then not install the plugin to the Scene.
6868
* The Scale Manager has a new event `FULLSCREEN_FAILED` which is fired if you try to enter fullscreen mode, but the browser rejects it for some reason.
6969
* The `ScaleMode` Component has been removed from every Game Object, and along with it the `scaleMode` property and `setScaleMode` method. These did nothing anyway as they were not hooked to the render pipeline and scale mode should be set on the texture, not the Game Object. Fix #4413 (thanks @jcyuan)
70+
* The `Clock.now` property value is now synced to be the `TimeStep.time` value when the Clock plugin boots and is no longer `Date.now()` until the first update (thanks @Antriel)
7071

7172
### Bug Fixes
7273

src/time/Clock.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var Clock = new Class({
5353
* @type {number}
5454
* @since 3.0.0
5555
*/
56-
this.now = Date.now();
56+
this.now = 0;
5757

5858
// Scale the delta time coming into the Clock by this factor
5959
// which then influences anything using this Clock for calculations, like TimerEvents
@@ -129,6 +129,9 @@ var Clock = new Class({
129129
*/
130130
boot: function ()
131131
{
132+
// Sync with the TimeStep
133+
this.now = this.systems.game.loop.time;
134+
132135
this.systems.events.once(SceneEvents.DESTROY, this.destroy, this);
133136
},
134137

0 commit comments

Comments
 (0)