Created
May 30, 2013 08:27
-
-
Save AlexTiTanium/5676482 to your computer and use it in GitHub Desktop.
Time scale independent Particle system in unity3d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now, in Unity 2017 there is a Delta Time option which we can set to Unscaled.