/*private IEnumerator TakeScreenshotAndSave() * { * yield return new WaitForEndOfFrame(); * * Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); * ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); * ss.Apply(); * * // Save the screenshot to Gallery/Photos * Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, "GalleryTest", "My img {0}.png")); * * // To avoid memory leaks * Destroy(ss); * }*/ private void Load100Images(int maxSize) { ag = AndroidGallery.GetInstance("VRActor1"); GameObject[] quads = GameObject.FindGameObjectsWithTag("Frame"); Debug.Log("Load Frame Tages" + quads[0]); Debug.Log("Selected Quad : " + quads[0].transform.Find("Quad")); string[] imgs = ag.GetRecent100(); int i = 0; foreach (GameObject q in quads) { if (imgs[i] != null) { // Create Texture from selected image Texture2D texture = NativeGallery.LoadImageAtPath(imgs[i], maxSize); if (texture == null) { Debug.Log("Couldn't load texture from " + imgs[i]); return; } GameObject quad = q; Material material = quad.transform.Find("Quad").GetComponent <Renderer>().material; if (!material.shader.isSupported) // happens when Standard shader is not included in the build { material.shader = Shader.Find("Legacy Shaders/Diffuse"); } material.mainTexture = texture; // If a procedural texture is not destroyed manually, // it will only be freed after a scene change //Destroy(texture, 5f); i++; } } }