- Home /
Cheapest/Easiest way to just draw a bunch of pixels right to the screen
Hey! I'm making a simple pixelly world map creator and I'd like to know what's the most efficient way to draw individual pixels. I need to maintain individual control over each pixel, as each directly corresponds to a 'cell' which will have map values such as height, habitability, temperature, etc.
I've tried two approaches.
The first was having a simple square quad prefab which I could then instantiate a bunch of and custom colour. This had the advantage that each pixel could store its own values.
I thought it'd be cheaper to simply have one large, screen-filling quad and change its texture directly, but surprisingly I found it to be more demanding. (Though it occurs to me now that maybe I could make the camera view really small so that each pixel corresponds to an actual texel.) Is there an extremely obvious approach I'm missing? Still pretty new to Unity. Thanks!
Anyway, this is an idea of the kind of view I want. (This is just a bunch of randomly generated map regions, each randomly coloured.)
Hey $$anonymous$$an, did you solve this problem? Because i want to draw exactly 1280x720 pixels and manage each one. If I instantiate each pixel as a gameobject that doesnt work fine (very heavy). Thanks
Just draw to a sprite's Texture2D using GetPixels and SetPixels?
https://docs.unity3d.com/ScriptReference/Texture2D.GetPixels.html
https://docs.unity3d.com/ScriptReference/Texture2D.SetPixels.html
Your answer
Follow this Question
Related Questions
Perfect 2d image 1 Answer
Rotated Pixel Textures 1 Answer
Clear, Crisp pixel textures for a 2D RPG 2 Answers
Anti aliasing with sprites 0 Answers