How to make spawning in the game compatible with Time.timescale?

Hi,

I do scheduling of spawning of enemies in my game based on amount of passed time with real world time but I want to be able to make it get slower and faster according to Time.timescale so when I change the time scale and all game’s speed changes, the spawn algorithm would act accordingly.

How can I achieve this?

Thanks.

This is either a easy fix or I don’t understand your problem. Rather than use real world time, create a float variable called myTimeScale and use it for your spawning. Increment by Time.deltaTime each frame. Since deltaTime is scaled, your myTimeScale will be adjusted.