Skip to content

Instantly share code, notes, and snippets.

@AlexTiTanium
Created May 30, 2013 08:27
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save AlexTiTanium/5676482 to your computer and use it in GitHub Desktop.
Save AlexTiTanium/5676482 to your computer and use it in GitHub Desktop.
Time scale independent Particle system in unity3d
using UnityEngine;
using System.Collections;
public class ParticaleAnimator : MonoBehaviour {
private void Awake()
{
particle = GetComponent<ParticleSystem>();
}
// Use this for initialization
void Start ()
{
lastTime = Time.realtimeSinceStartup;
}
// Update is called once per frame
void Update ()
{
float deltaTime = Time.realtimeSinceStartup - (float)lastTime;
particle.Simulate(deltaTime, true, false); //last must be false!!
lastTime = Time.realtimeSinceStartup;
}
private double lastTime;
private ParticleSystem particle;
}
@temresen
Copy link

temresen commented Nov 2, 2017

Now, in Unity 2017 there is a Delta Time option which we can set to Unscaled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment