- Home /
Time.timescale cause extreme lag?
Hi the script below is for a tapping game so when I tap on the object this is attached to it will disable the renderer and set Time.timescale to 0.4 which gives it a slow motion effect and it does but it lags making the objects fall look like their scraping the back background(their movement is really laggy). Any suggestions on how to make it a smooth slow mo effect?
var explosionPrefab : Transform;
var audioTap : AudioClip;
function OnMouseDown () {
if (gameObject.tag == "BubbleSlowTime") {
var boom : Transform = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
gameObject.renderer.enabled = false;
audio.PlayOneShot(audioTap);
Time.timeScale = 0.4;
yield WaitForSeconds(0.6);
Destroy(explosionPrefab);
yield WaitForSeconds(2.0);
Time.timeScale = 1;
Debug.Log("Slow Time");
}
}
Hi there, check this answer out it might help
http://answers.unity3d.com/questions/39279/how-to-get-smooth-slow-motion.html
Thanks aceX I did and it didn't effect my code at all?
Answer by Mwarw · Sep 16, 2017 at 07:58 AM
This is old topic, so you probably solved this, but other people might have problem with it so here's simple but not perfect solution try to increase Position and velocity iteration in physics/physics2D settings. It might cause problems with optimalization if game has them already, but slowed time movement might be more smooth.
Your answer
Follow this Question
Related Questions
Show "Score:5" on my screen, how? 1 Answer
Setting Scroll View Width GUILayout 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Realistic Bouncing Effect 1 Answer
Faux Gravity Prolem? #2 2 Answers