U3D慢镜头及各个物体慢速度播放
----------------------------整体时间慢速度播放------------------------PlaySpeed.CS----------

 

using System.Collections;

 

using System.Collections.Generic;

 

using UnityEngine;



public class Playspeed: MonoBehaviour {

 

public float mySpeed =1;

 

// Use this for initialization

 

void Start () {

 

}

 

// Update is called once per frame

 

void Update () {

 

Time.timeScale= mySpeed;

 

}

 

}



----------------------------具体角色慢速度播放---------------------ChrSpeed.CS-------------

 

using System.Collections;

 

using System.Collections.Generic;

 

using UnityEngine;



public class ChrSpeed: MonoBehaviour {

 

public float mySpeed =1;

 

// Use this for initialization

 

void Start () {

 

}

 

// Update is called once per frame

 

void Update () {

 

this.GetComponent<Animator>().speed = mySpeed;

 

}

 

}



----------------------------具体粒子慢速度播放-----------------PtSpeed.CS-----------------

 

using System.Collections;

 

using System.Collections.Generic;

 

using UnityEngine;



public class PTspeed : MonoBehaviour {

 

public float mSpeed =1;

 

// Use this for initialization

 

void Start () {



}



// Update is called once per frame

 

void Update () {

 

this.GetComponent<ParticleSystem>().playbackSpeed = mSpeed;

 

}

 

}



--------------------具体粒子及子级粒子的慢速度播放-----------PTspeedChildren .cs --------------------

 

using System.Collections;

 

using System.Collections.Generic;

 

using UnityEngine;



public class PTspeedChildren : MonoBehaviour {

 

public float mSpeed =1;

 

// Use this for initialization

 

void Start () {



}



// Update is called once per frame

 

void Update () {

 

//this.GetComponent<ParticleSystem>().playbackSpeed = mSpeed;

 

ParticleSystem[] aaa = this.gameObject.GetComponentsInChildren<ParticleSystem>();

 

    foreach(var p in aaa)

 

        {

 

            p.playbackSpeed = mSpeed;

 

        }

 

}

 

}