Particles lag/stutter - choppy movement

Here’s the problem. In my game I have a moveable player which has a rigidbody attached. The position as well as it’s velocity is controlled in the script via simple assignment (rigidbody.position += etc). Now, the camera movement is based on player’s position as well as it’s velocity (it zoom out when the player goes faster and position itself respectively to it’s speed and position). Of course because the camera’s adjustments are based on the rigidbody I had the common problem of the world/cameras’s jerkiness. Based on what’s manual says and through pure logic I decided to put all the camera’s adjustment code into FixedUpdate function and that did the trick.
Finally, the matter from the question… having my camera and player moving exceptionally smoothly I’ve noticed that the particles from my particle systems (instantiated dynamically) had a choppy movement… Unfortunately, because my knowledge wasn’t sufficient I spent some time on it, trying to find something on the internet, but in vain. Then it struck me, as I’ve already had similar problem and a solution sufficed, I’ve moved particles simulation to FixedUpdate as well (code below), and voila, it started to work.
And of course the question: is it a good practice having my particles update functionality moved to FixedUpdate and if not, what’s the best solution for the situation described above?

using UnityEngine;
using System.Collections;

public class FixedTimeParticleSystem : MonoBehaviour {
	
	private ParticleSystem ps;
	private bool playing = false;

	private void Awake() {	
		ps = GetComponent<ParticleSystem>();
	}

	public void Restart() {
		ps.Simulate(0.0f, true, true);
		playing = true;
	}

	public void Stop() {
		playing = false;
	}

	void FixedUpdate() {
		if(playing)
			ps.Simulate(Time.fixedDeltaTime, true, false);
	}
	
}

I know this is an old topic… I was wondering, KEric, can you post the code you used to get your camera to follow smoothly so that the world isn’t jerky around it? I am having that issue right now and I am pulling my hair out! I like my hair…

I have tried putting it into fixedupdate, but haven’t had much luck, I wouldn’t mind seeing if you’re doing something that I’m missing.

Remove simulation and use play/stop/clear instead.
If possible add your particle system to an empty object and put it as a child of the camera (this will keep it at the same distance all the time).
Particle system API you should take a loot at it. :wink:

I think the problem was with the scale of the game world which was very small.
When I’ve tested the gameplay with values of physics and rendering threads slowed down significantly (Time.timeScale, Time.fixedDeltaTime values) the choppy movement disappeared.