private IEnumerator TakeScrShot()
    {
        yield return(new WaitForEndOfFrame());


        int       width  = Screen.width;
        int       height = Screen.height;
        Texture2D tex    = new Texture2D(width, height, TextureFormat.RGB24, false);

        tex.ReadPixels(new Rect(0, 0, width, height), 0, 0);
        tex.Apply();

        var bytes = tex.EncodeToPNG();

        var path = System.IO.Path.Combine(Application.persistentDataPath, "IMG_" + CountScreen.ToString() + ".png");

        System.IO.File.WriteAllBytes(path, bytes);

        Debug.Log(path);
        CountScreen++;

        PlayerPrefs.SetInt("CountScreen", CountScreen);
        canvasObject.SetActive(true);
        SpotLight.SetActive(false);
        for (int i = 0; i < sprites.Length; i++)
        {
            if (sprites [i] == null)
            {
                sprites [i] = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
                i           = sprites.Length;
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (prosmotr == 1)
        {
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                for (int i = NumI + 1; i < sprites.Length; i++)
                {
                    if (sprites [i] != null)
                    {
                        //_AudioSource.clip = clipCamBut;
                        //_AudioSource.Play ();
                        ImageShowPhoto.sprite = sprites [i];
                        if (i != sprites.Length)
                        {
                            NumI = i;
                        }
                        i = sprites.Length;
                    }
                }
            }
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                for (int i = NumI - 1; i > -1; i--)
                {
                    if (sprites [i] != null)
                    {
                        //	_AudioSource.clip = clipCamBut;
                        //_AudioSource.Play ();
                        ImageShowPhoto.sprite = sprites [i];
                        if (i == 0)
                        {
                            NumI = i;
                        }
                        if (i > 0)
                        {
                            NumI = i;
                        }
                        i = 0;
                    }
                }
            }

            if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.DownArrow))
            {
                canvasPhotoObject.SetActive(false);
                canvasObject.SetActive(true);
                prosmotr = 0;
            }
        }
        if (Input.GetKeyDown(KeyCode.Return))
        {
            _AudioSource.clip = clipCamBut;
            _AudioSource.Play();
            if (NumBut == 0)
            {
                vsrich++;
                if (vsrich > 1)
                {
                    vsrich = 0;
                }
                if (vsrich == 0)
                {
                    IconFlash.color = new Color(1, 1, 1, 0.3f);
                }
                if (vsrich == 1)
                {
                    IconFlash.color = new Color(1, 1, 1, 1f);
                }
            }

            if (NumBut == 1)
            {
                canvasObject.SetActive(false);
                for (int i = NumI; i < sprites.Length; i++)
                {
                    if (sprites [i] != null)
                    {
                        ImageShowPhoto.sprite = sprites [i];
                        if (i != sprites.Length)
                        {
                            NumI = i;
                        }
                        i = sprites.Length;
                    }
                }
                canvasPhotoObject.SetActive(true);
                prosmotr = 1;
            }
        }
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            _AudioSource.clip = clipCamBut;
            _AudioSource.Play();
            NumBut++;
            if (NumBut > 1)
            {
                NumBut = 0;
            }

            if (NumBut == 0)
            {
                ImageBorder.rectTransform.anchoredPosition = IconFlash.rectTransform.anchoredPosition;
            }
            if (NumBut == 1)
            {
                ImageBorder.rectTransform.anchoredPosition = IconPhoto.rectTransform.anchoredPosition;
            }
        }
        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            _AudioSource.clip = clipCamBut;
            _AudioSource.Play();
            NumBut--;
            if (NumBut < 0)
            {
                NumBut = 1;
            }

            if (NumBut == 0)
            {
                ImageBorder.rectTransform.anchoredPosition = IconFlash.rectTransform.anchoredPosition;
            }
            if (NumBut == 1)
            {
                ImageBorder.rectTransform.anchoredPosition = IconPhoto.rectTransform.anchoredPosition;
            }
        }
        if (Input.GetKeyDown(KeyCode.R))
        {
            if (yescam == 1)
            {
                canvasObject.SetActive(false);
                if (vsrich == 1)
                {
                    SpotLight.SetActive(true);
                }
                _AudioSource.clip = clipClipShot;
                _AudioSource.Play();

                StartCoroutine("TakeScrShot");
            }
        }
        if (!CamAnimation.isPlaying)
        {
            CameraObject.SetActive(false);
        }
        if (canv == 1)
        {
            if (!CamAnimation.IsPlaying(NameAnimUpCam))
            {
                canvasObject.SetActive(true);
                canv   = 0;
                yescam = 1;
            }
        }
        if (prosmotr != 1)
        {
            if (Input.GetKeyDown(KeyCode.E))
            {
                if (!CamAnimation.isPlaying)
                {
                    _AudioSource.clip = clipCameraUpDown;
                    _AudioSource.Play();
                    if (UpDown == 1)
                    {
                        CameraObject.SetActive(true);
                        canvasObject.SetActive(false);
                        yescam = 0;
                        _Camera.fieldOfView = 60;
                        CamAnimation.clip   = animClipDown;
                        _Camera.fieldOfView = 60;
                    }
                    if (UpDown == 0)
                    {
                        CameraObject.SetActive(true);
                        canv = 1;
                        CamAnimation.clip = animClipUp;
                    }
                    CamAnimation.Play();
                    UpDown++;
                    if (UpDown > 1)
                    {
                        UpDown = 0;
                    }
                }
            }
        }
    }