![]() ![]() You can also look at the API here to find the location folders for each platform. NativeGallery.SaveImageToGallery(imageBytes, "AlbumName", "ScreenshotName. This will also print the output location to the debug console so you can see where the screenshots are being saved. Now, inside of Unity, the first thing I did was create a. #Unity capture screenshot path for android androidScreenImage.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0) īyte imageBytes = screenImage.EncodeToPNG() It is not possible to access the StreamingAssets folder on WebGL and Android platforms. In this case only the Game view can be captured. Note: Screenshots can be made from the Editor as described above. The resulting screenshot is available later. At this point I carefully broke down a frame to see exactly what was happening. On Android this function returns immediately. Unfortunately, I was still seeing a 2ms sync, as shown in the previous screenshot. See Application.persistentDataPath for more information. ![]() Texture2D screenImage = new Texture2D(Screen.width, Screen.height) On mobile platforms the filename is appended to the persistent data path. To save the image with the plugin, you have to abandon the ScreenCapture.CaptureScreenshot function and manually take the screenshot yourself with the ReadPixels function, convert it to png or jpeg then save the byte array with the NativeGallery.SaveImageToGallery function. This saves you time of having to make your own. Find this integration tool & more on the Unity Asset Store. ![]() The NativeGallery plugin which is free and works for both Android and iOS can be used to do this with the NativeGallery.SaveImageToGallery function. Use the Capture & Save Screenshot Android and iOS from Turzo on your next project. The Android requires the gallery to be refreshed after saving the image. This plugin saves the image and returns the path to it. #Unity capture screenshot path for android codeYou need a plugin to save image to the gallery. A simple plugin to take screenshots using native code (iOS & Android). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |