UnscaleTimeEffect.cs 714 B

12345678910111213141516171819202122
  1. using UnityEngine;
  2. using System.Collections;
  3. public class UnscaleTimeEffect : MonoBehaviour {
  4. // Use this for initialization
  5. void Start () {
  6. ParticleSystem[] pss = GetComponentsInChildren<ParticleSystem>(true);
  7. for (int i = 0; i < pss.Length; i++)
  8. {
  9. UnscaleTimePartical utp = pss[i].gameObject.GetComponent<UnscaleTimePartical>();
  10. if (utp == null)
  11. utp = pss[i].gameObject.AddComponent<UnscaleTimePartical>();
  12. }
  13. Animator[] animators = GetComponentsInChildren<Animator>(true);
  14. for (int i = 0; i < animators.Length; i++)
  15. {
  16. animators[i].updateMode = AnimatorUpdateMode.UnscaledTime;
  17. }
  18. }
  19. }