Hello guys,
Is there a time scale like feature in Cocos 3.1? I want to slow down the time as per game requirement. Thanks.
Hello guys,
Is there a time scale like feature in Cocos 3.1? I want to slow down the time as per game requirement. Thanks.
I use this function and its’ working for me on 3.0 (should work on 3.1 as well)
import {director } from 'cc';
export function setTimeScale(scale:number):void {
director.calculateDeltaTime = function(now) {
if (!now) now = performance.now();
this._deltaTime = (now - this._lastUpdate) / 1000;
this._deltaTime *= scale;
this._lastUpdate = now;
};
}
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
Hey, It worked. Thanks a lot. Editor was showing error but it worked in runtime.