- Home /
Save a map as a PNG file.
Hi everyone, I am working on 2D Platformer right now. I need to save all object (sprite) into a PNG file. Is it possible? For example This is a map I make though the game (in real time). I would like to save it to something like this.
(This picture is not from me. I found it on youtube). Thank.
Answer by leocub58 · Apr 21, 2020 at 02:12 AM
https://github.com/leocub58/Tilemap-to-PNG-Unity
I made this asset to export tilemaps as PNGs
$$anonymous$$uch appreciate, did not expect someone make an asset for this old post. Thank you! ps. I also subscribe your channel ;)
Answer by RobAnthem · Dec 26, 2016 at 06:49 PM
Is that a scene, or an Image? Is it Terrain we are looking at, or a custom tile-based map painter? I've been working a lot on In-Editor image editing and it wouldn't be very hard to create something similar, but as an image editor inside the editor. As far as I know, there is no magical way, like in WPF, to serialize a control as an image.
What you see in the first picture is a scene. I want a player to be able make a custom map (build block, character etc.) and save it. I can use XmlSerializer to save all sprite. However, I have see this tutorial (https://www.youtube.com/watch?v=5RzziXSwSsg ) where you can import a png file (by using photoshop) into unity. So if I can "reverse" this, it would make much easier for player to edit it.
Well if it a terrain object, it would be pretty easy to iterate heights and colors and store them, if it is a 3d model you can iterate the texture pixels, if it is an image then your work is even easier.
Answer by SITH-RULER · Dec 27, 2016 at 12:48 PM
guessing you watched quill18's video on "level editor" in unity. the purpose of the video was to show how to use colors to make a image(which you created outside of unity) as a template to build levels which means every color in that image corresponds to a certain gameobject in an array that will be placed on that block of color if you could save the png which you can you would also need a system to convert that images colors into colors which correspond to the colors which are coded in the level editor script which is sorta difficult and confusing but if you just want to take a screenshot and edit it later just use
https://docs.unity3d.com/ScriptReference/Application.CaptureScreenshot.html
hope this helps!
Oh! I see your point. Even though I did not want to screenshot. But your explain help me a lot. I guess it is likely not possible to do that. Thank you!
Your answer
![](https://koobas.hobune.stream/wayback/20220612103243im_/https://answers.unity.com/themes/thub/images/avi.jpg)