Using Time.time for Oscillator creates inconsistent behavior on level load

#comment

I noticed that Time.time tracks the amount of time that has passed from game start. This may be the behavior you want, but it means on each level load or reload the oscillator’s position and direction may be different. To make sure the oscillator’s movement is the same each time a level is loaded you can use Time.timeSinceLevelLoad.

So instead of

float cycles = Time.time / period;

– you can use –

 float cycles = Time.timeSinceLevelLoad / period;
1 Like

Privacy & Terms