- Home /
Lag when Timescale is 1?
Hello, i've encountered a problem where I don't know what could be causing it.
I normally code at a pretty decent computer so I never noticed it before. But , right now I'm temporarily on a laptop that is a lot worse.
When I play my game, my fps hangs around 30fps. But when I pause my game and set the Timescale to 0. It goes back up to 60-70. On this laptop and the iPad that I test on it goes from unplayable to smooth.
What could be causing this?
I use Timescale for a timer only.
Thanks,
Kris
Answer by Slayerkris · May 02, 2013 at 01:31 PM
I managed to fix my problem. It was caused by the models I was loading in. When I selected one of the models and looked at the inspecter, I went to "Rig" and noticed that the Animation Type was set to Generic. Even though the models don't have any animation.
I changed the Animation Type to None on all of my models and the lagg was gone :D.
I'm guessing setting the TimeScale to 0 made it so that the animations are stopped(even though I had none).
Answer by pudd1nG · Apr 24, 2013 at 08:51 AM
Timescale is the scale at which the time is passing. This can be used for slow motion effects.
When timeScale is 1.0 the time is passing as fast as realtime. When timeScale is 0.5 the time is passing 2x slower than realtime.
When timeScale is set to zero the game is basically paused if all your functions are frame rate independent.
Except for realtimeSinceStartup, timeScale affects all the time and delta time measuring variables of the Time class.
If you lower timeScale it is recommended to also lower Time.fixedDeltaTime by the same amount.
FixedUpdate functions will not be called when timeScale is set to zero. Which is why your game FPS goes up, physics stop processing is probably the biggest FPS boost.
Moral of the story, don't mess with the timescale unless you really need to
Yes, i think you have something heavy in FixedUpdate or the physics system in general. $$anonymous$$aybe you have collisions every frame?
Hmm I don't think so. I can play the game just fine when I put Timescale on 0. the only thing that isnt working is the timer. The game is a 3d puzzle game. with just some raycasting and gameobjects changing from color.
Which is why your game still (mostly) runs while timescale is 0. Don't set timescale to 0 unless you're pausing the game. If you let me know exactly what you're using timescale 0 to achieve I can provide an alternative
The only reason I put the Timescale on 0 is because it seemed to remove my fps lag. I don't $$anonymous$$d putting it on 1 but then the lagg returns. I'm just wondering. It should be something that gets disabled when I pause the game. but everything works like expected when I put it on 0. I got no collisions or physics. just ray casting and changing colors of game objects
If your game does run fine with it on 0 then you can keep it on 0, however the better option would be to check through your quality settings and code (especially raycasts) to make sure everything is as optimized as it can be. Another good one for slow paced games like what you've mentioned it to adjust the timestep. A simple game shouldn't lag at all on default though. Good luck
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
A* Pathfinding questions 1 Answer
Why so much GPU usage for an empty scene ? 0 Answers
Too much lag in the game 5 Answers
Unity Editor lag 0 Answers