示例#1
0
    private void TakePicture()
    {
        if (System.IO.File.Exists(GetFilePath()))
        {
            System.IO.File.Delete(GetFilePath());
        }

        scroll.AddContent(new string[] { "Taking Picture..." });
        scrollButton.ShowPanel();

        Texture2D snap = new Texture2D(wct.width, wct.height);

        snap.SetPixels32(wct.GetPixels32());
        snap.Apply();
        #if UNITY_ANDROID
        snap = rotateTexture(snap, true);
        #endif
        System.IO.File.WriteAllBytes(GetFilePath(), snap.EncodeToJPG());
        string filename = string.Format("{0}/screen_UNITY_{1}.png", Application.temporaryCachePath, System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
        System.IO.File.WriteAllBytes(filename, snap.EncodeToJPG());
        Debug.Log("saved to: " + filename);
    }