public class CameraShake : MonoBehaviour { // Use this for initialization Matrix4x4 originalProjection; float timer; void Start () { originalProjection = camera.projectionMatrix; //StartCoroutine(Shake(0.5f)); } // Update is called once per frame void Update () { } public void camera_Shake() { StartCoroutine(Shake(0.05f)); } public IEnumerator Shake(float gap) { timer = Time.time; while(Time.time - timer <= gap) { Matrix4x4 p = originalProjection; p.m01 += Mathf.Sin(Time.time * 120F) * 0.01F; p.m10 += Mathf.Sin(Time.time * 150F) * 0.01F; camera.projectionMatrix = p; yield return 0; } camera.ResetProjectionMatrix(); } }