If anybody has any issues accessing NativeGallery from a script (i.e vsStudio or whatever doesn't recognize it and gives a red error line), transfer NativeGallery's folders to your script files.
@mikewigen86463 жыл бұрын
omg yes! Dude. I've been following 10 different tutorials and read thousands of forum posts and I always got soldi black screenshots, they never show my stuff but your tut worked for me. thank you.
@MaxMakesGames3 жыл бұрын
I'm glad it worked !
@marcellyrangel54193 жыл бұрын
Man thank you so much for doing everything that I asked, you made me so happy you have no idea! You’re such a nice person, and your tutorials are 10/10 👌🏻😍
@MaxMakesGames3 жыл бұрын
Thanks a lot ! And no problem, your ideas were good. Don't hesitate to ask if you want to see other things :)
@belajashark Жыл бұрын
Thank you so much, I exactly need taking screenshots without UI elements!!!!
@qabashameed71362 жыл бұрын
Thank you so much for this video. It works from the first run I spent days for this solution and this is the only one that worked
@MaxMakesGames2 жыл бұрын
Glad I could help 😃
@haroo315 Жыл бұрын
Thank you so much!! I've been struggling with this problem and your video solved everything 😆 Have a great day! 👍
@MaxMakesGames Жыл бұрын
Thanks for watching, you too !
@28mukromka84Ай бұрын
i love you man, u just save my life, thank u
@cloudbaseddev49133 жыл бұрын
Really Helpful Bro!! Subscribed!
@MaxMakesGames3 жыл бұрын
Thanks a lot ! :)
@Wonder_Verse_Tech3 жыл бұрын
You are a life saver, I got irritated from others video on screenshot and want some latest video. Will implement it in my game. Thank you. All the best , you will definitely grow so much. Edit : Bro please help, screenshot is not showing anywhere in my mobile... Where it is saved??
@MaxMakesGames3 жыл бұрын
Thank you, if you use the Native Gallery package like I did after 6:43 the image should be saved into your gallery path so "On Android, your images/videos are saved at DCIM/album/filename. On iOS 14+, the image/video will be saved to the default Photos album (i.e. album parameter will be ignored). On earlier iOS versions, the image/video will be saved to the target album. Make sure that the filename parameter includes the file's extension, as well". If you use the PC code before 6:43 then it will be saved in your app's folder so you can only see it by exploring the files, not in your gallery. If you used Native Gallery and used the same code I did and made sure your file name is valid ( some characters may not be allowed and you need it to end with the right extension like .png ) and it did not work, you can try reading the github page for possible fixes or contact the devs, I didn't make the package so I can't help you if you get errors. github.com/yasirkula/UnityNativeGallery
@sevemz33593 жыл бұрын
Thank you, you made the process easier
@MaxMakesGames3 жыл бұрын
Glad to hear that! :D
@hardworkerstudio3 ай бұрын
Thank you very much for the tutorial, I followed you because of this tutorial! So.. for the Android I have to enable Developer mode every time? and my customer need to do it too? and for the iOS users?
@Yukisando8 ай бұрын
Thanks bud! Cool plugin.
@erbiis9961 Жыл бұрын
hello, is the savemanager script in the empty gameobject affecting the screenshot saving process? i dont see it when i create the empty gameobject and when i go through with all the steps, the screenshot is not taken
@elirapendora23972 жыл бұрын
Uhmmm I have a question it works fine for me in Unity Thank you very much ! But I have a small problem when I build it and try to screenshot it doesn't work for some reason I dont need to save it I just need to pass the texture to the object it works in the compiler but when built it doesn't
@MaxMakesGames2 жыл бұрын
Hmmm that's very strange. I suggest you look on the plug-in GitHub page. They have a QnA where they explain how to fix common errors. I didn't make the plug-in so I couldn't tell you how to fix that, sorry.
@liviwilmore73372 жыл бұрын
Great Tutorial! Seem to be falling at a very early hurdle though; When I add my GameObject with the script attached to my button, Under function TakeScreenshot isn't listed under my Screenshot script. My script for this looks just like yours; public void TakeScreenshot() { StartCoroutine("DoScreenshot"); } Any ideas why this might be? My project is an AR project if you think that might effect anything at all?
@MaxMakesGames2 жыл бұрын
Hmmm that is really strange. If you have a public void TakeScreenshot() in your script, when you drag your gameobject with your script in your button, the function should appear. Do you see any other functions of your script appear ? Are you sure you dragged the right one ? Did you save your file after adding the function so Unity can see it ? You can also try restarting your project.
@hirannair50412 жыл бұрын
I'm getting this error: "ReadPixels was called to read pixels from system frame buffer, while not inside drawing frame."
@MaxMakesGames2 жыл бұрын
Hmmm it seems like this could be due to when the code is ran. If it is ran in the middle or between frames, it could do that. Make sure you are yielding until the end of the frame like I did in the video at the top of the screenshot function. ( like this: docs.unity3d.com/ScriptReference/WaitForEndOfFrame.html ). This way, you can make sure the scene is done drawing before reading so you make sure everything is in the screenshot and that you don't get errors. If it doesn't work for some reason, try using the "OnPostRenderCallback" function like on this page: docs.unity3d.com/ScriptReference/Texture2D.ReadPixels.html
@Kerem_MertGakadatil2 жыл бұрын
Image I saved turns out to be yellowish in PC
@graphiteji2 жыл бұрын
I want to load the saved file in the same scene tell me how
@MaxMakesGames2 жыл бұрын
You can just keep the texture2d you created when saving and then set it on a sprite in your scene with Rect rect = new Rect(0, 0, texture.width, texture.height); Vector2 pivot = new Vector2(0.5f, 0.5f) Sprite sprite = Sprite.Create(texture, rect, pivot); spriteobject.GetComponent().sprite = sprite; //replace with whatever sprite you want to change.
@seanburns62083 жыл бұрын
Max great video, thank you very much. It's working great for me on PC but when I build to Android (Galaxy S7) the screenshot doesn't seem to work or else I just can't find it gallery. Any suggestions? Did you run into any similar issues at the start? Also, any tips on including a share button?
@MaxMakesGames3 жыл бұрын
Hey, thanks a lot. When you built it on your phone, did you switch the code to using UnityNativeGallery ? After 6:43 I show a different code for mobile, using the PC code on mobile will not add it to the gallery. If you did and it doesn't work, then maybe try reading the github page for QnA and other information that may help you fix or contacting the UnityNativeGallery devs at github.com/yasirkula/UnityNativeGallery Since I didn't make it and it worked for me ( Huawei P20 ), I can't really help you with this :( For sharing I don't think it's worth taking time to make it yourself, as there are already things you can import and work with for free. With a quick search I found this that seems good, but you can probably find many others: forum.unity.com/threads/native-share-for-android-ios-open-source.519865/ ( "Native Share for Android & iOS" on asset store )
@adairvillalba17792 жыл бұрын
como le puedo agragar una marca de agua a esta captura de pantalla, la imagen de agua que sea otra imagen.
@MaxMakesGames2 жыл бұрын
I don't know exactly but I'd suggest looking into doing it with textures. For example, the screenshot is loaded as a texture before being saved so if you load your watermark as a texture too, you can probably put the watermark on the screenshot. Try something like this: answers.unity.com/questions/1561563/combine-2-textures-of-different-sizes-at-specific.html
@noorsalama89112 жыл бұрын
thanks for the tutorial , but where will these screenshots be located after taking a screenshot
@tabithaabbott54782 жыл бұрын
Hello Hello! Does this approach work for WebGL builds? Ive been stuck for a week. Edit: do any of the multiple approaches in the video work for webl builds? I’m trying to save screenshot from game on website on to users devices.
@MaxMakesGames2 жыл бұрын
I haven't tried it sorry. You can check the library's GitHub in the description they probably say if it does.
@Ekalaivan3 жыл бұрын
Thanks man, this working great, is there anyway to use the same plugin to record videos?
@MaxMakesGames3 жыл бұрын
Sorry I don't think this plugin is made for that. Recording gameplay is usually pretty tricky so you might not find a plugin directly for it :(
@Ekalaivan3 жыл бұрын
@@MaxMakesGames exactly, got one plugin for recording video but it's deprecated from Android 9 it seems. I don't know why Google keep on reducing the controls. Stucking with another project for enabling mobile's flashlight for a AR session with Vuforia, where the Torch light working fine on Oreo devices but not working on latest Android Device.
@arnauz112 жыл бұрын
if i want to save screenshot in downloads, what i have to do? because if i upload my game, the players will not have Application datapath
@MaxMakesGames2 жыл бұрын
When you build the game for release, the Application datapath will become the folder where your game exe data is I believe. So when the player run your game and take a screenshot, it will be saved where they have your game in their PC. However, after looking into it a bit, I'd recommend using Application.persistentDataPath instead to make sure the screenshots wont be deleted in updates and that the path doesn't change. On Windows, the files will be saved at "%userprofile%\AppData\Local\Packages\\LocalState". You can see more details here: docs.unity3d.com/ScriptReference/Application-persistentDataPath.html If you really want the screenshots to be with the game files, then check out dataPath to see where it goes: docs.unity3d.com/ScriptReference/Application-dataPath.html
@arnauz112 жыл бұрын
@@MaxMakesGames but this way is very complicate for player because he/she doesn't know where screenshot is. If the screenshot saves in download files of pc, will be perfect.
@MaxMakesGames2 жыл бұрын
@@arnauz11 All games save their screenshot in the game folders. Minecraft saves it in appdata for example. If you really want to save in the download folder, you'll have to use C# to get the path and use that path instead of Application Data path.
@arnauz112 жыл бұрын
@@MaxMakesGames thanks
@兔兔-y4f2 жыл бұрын
ty i love u 😍
@adairvillalba17792 жыл бұрын
cual es la versión de Native Gallery para la versión de unity 2019.4.35f.
@MaxMakesGames2 жыл бұрын
Try the latest version, it should work.
@adairvillalba17792 жыл бұрын
@@MaxMakesGames no me funcionó, solo me funciona para las versiones superiores a 2019
@1234yokee2 жыл бұрын
Thank so much. You are my life saver . But i have a small problem. my screenshot image size is too small (284x568) . How to fix this sir? pls
@MaxMakesGames2 жыл бұрын
Thank you. If you used the same code as me, the screenshot size should be the size of the screen or window. When you create the texture, you can set the size. I put the screen width and height in the video, but you can put whatever you want. Just be aware that if you increase the texture size but use a smaller size in the ReadPixels, then it won't fill your texture. Maybe you are testing your game in a small 284x568 window ? Try making it full screen and see what it does 😁
@MegaCX3 жыл бұрын
How can I save a screenshot in documents?
@MaxMakesGames3 жыл бұрын
You need to check the path for documents on your PC and use that instead of the application dataPath. In my case, it is "C:\Users\Admin\Documents\" so I would use File.WriteAllBytes("C:\Users\Admin\Documents\ScreenShot.png", bytes) And ofc like I showed after you can add a timestamp so every screenshot has a different name.
@shortStories197 Жыл бұрын
How to load those pictures in game
@MaxMakesGames Жыл бұрын
You can load a PNG file as bytes onto a Texture2D in Unity by using the LoadImage function of the Texture2D class. This function takes a byte array as an argument, which can be obtained from the PNG file. Here’s an example: string filePath = ... // The path to the PNG file byte[] imageBytes = File.ReadAllBytes(filePath); Texture2D texture = new Texture2D(1,1); texture.LoadImage(imageBytes); Once you have the Texture2D, you can display it on a canvas by creating a new RawImage object and setting its texture property to the Texture2D you created. Here’s an example: RawImage image = GetComponent(); image.texture = texture;
@SassyPantsy2 жыл бұрын
Btw you're the man
@MaxMakesGames2 жыл бұрын
Thanks ! 😁
@farikhanniazi70422 жыл бұрын
Plz Share the script screen short
@seymaple Жыл бұрын
do you know a way to do the same things just in a webgl build? and save to downloads?
@MaxMakesGames Жыл бұрын
I doubt it's possible from unity because to save a file from the web you need to ask the browser to ( kinda ). Maybe you could if you edit the JavaScript created after building the webgl and code that part in JavaScript directly but idk how exactly.
@mesmes94243 жыл бұрын
Can I assign the texture to the canvas image before saving it?
@MaxMakesGames3 жыл бұрын
Yes ! I would suggest using Sprite.Create ( docs.unity3d.com/ScriptReference/Sprite.Create.html ) to create a sprite from your texture, so something like Sprite sprite = Sprite.Create(texture2d, new Rect(0, 0, size, size), new Vector2(size/2,size/2)); Then set your canvas image sprite to that sprite using image.sprite = sprite;
@mesmes94243 жыл бұрын
@@MaxMakesGames Thank you ! After trying that and not succeeded I figured it out that we need also to comment out the Destory(texture) function for it to work.
@MaxMakesGames3 жыл бұрын
@@mesmes9424 Ahhhh yes it makes sense if you destroy the texture, it will not work. Thanks for telling your solution, maybe it can help others :)
@mesmes94243 жыл бұрын
@@MaxMakesGames Thank you for this great tutorial!
@paolademichelis50822 жыл бұрын
Thanks for the video tutorial, it's great! What about for WebGL build? How can I save screenshots directly from the web into my download folder?
@MaxMakesGames2 жыл бұрын
Thanks ! I searched a bit and apparently the only way would be to use JavaScript to open a file browser and save at the selected location. Apparently unity allows you to add custom JavaScript for web builds so try looking into that but I've never done it so I can't tell you more sorry.
@noorsalama89112 жыл бұрын
when i added this to my button and i try it out on the phone it asks if its ok to give access to my photos and i said ok to screenshot but i dont seem to find the screenshot , how can i find it ?
@MaxMakesGames2 жыл бұрын
If you used NativeGallery.SaveImageToGallery, the screenshot should be saved in your phone's gallery. The GitHub page for the plugin says this: On Android, your images/videos are saved at DCIM/album/filename. On iOS 14+, the image/video will be saved to the default Photos album (i.e. album parameter will be ignored). On earlier iOS versions, the image/video will be saved to the target album. You can read more and check for possible fixes if it's not working for you here: github.com/yasirkula/UnityNativeGallery
@noorsalama89112 жыл бұрын
@@MaxMakesGames i did use native gallery , and when I click the camera button in the editor it says successfully screenshot Taken but when I have it on phone , it seems that it screenshots but I don’t find it when I go to my gallery ? i mean should I assign any name to my script or
@MaxMakesGames2 жыл бұрын
@@noorsalama8911 Then it might be a problem with the plugin... I didn't make it so I can't really do anything about it. I suggest looking at their github I linked, they have a QnA and a bunch of infos. They also show different versions of the function you can try. If nothing works, maybe try contacting them. As you saw in the video it worked for me so I have no clue why it doesn't work for you... sorry :/
@noorsalama89112 жыл бұрын
@@MaxMakesGames by the way did you use the new or old input system for this ?
@MaxMakesGames2 жыл бұрын
@@noorsalama8911 I think I used the old one but it shouldn't matter as long as your code is being ran. You said it asked for permission so I'm guessing your code is being ran.
@nixter3612 жыл бұрын
Great tutorial. Can we also send the screenshot to server ?
@MaxMakesGames2 жыл бұрын
Hmmm I guess once the file is saved on the PC/Phone then you can upload it to a server, but I've never done that. Maybe search "C# server file upload" or something like that.
@techlightdev3 жыл бұрын
I can not save ScreenShot on my android device but pc is work. Can you help me ? thank you
@MaxMakesGames3 жыл бұрын
You need to use the native gallery plugin like I showed at the end. If it does not work, contact the devs on their GitHub. I didn't make it so I can't help you if you used the same code that worked for me but it doesn't for you, sorry...
@darkbatu2 жыл бұрын
thank you so much!!!
@MaxMakesGames2 жыл бұрын
You're welcome!
@Abedalaziz_game_dev2 жыл бұрын
Love you
@MaxMakesGames2 жыл бұрын
Love you too
@simpleguyissimple2 жыл бұрын
Does this also work on IOS?
@MaxMakesGames2 жыл бұрын
The GitHub page says it does but I haven't tried it :)
@simpleguyissimple2 жыл бұрын
@@MaxMakesGames okay thanks, man! Great content btw!