- Home /
Drawing a map to a texture
In my Unity3D game I want to display a map overlay on the screen, but I also want the user to be able to pan the map around. To start I created a Scroll View on my UI Canvas. However, since my maps are loaded from disk / randomly generated I can't simply create a bunch of Image objects in the editor.
From what I see I have two basic options, please let me know if I'm missing something:
Within a Script generate a bunch of Image objects and place them inside the Scroll View content pane object.
Create a RenderTexture and draw the map in my script then place that inside as the Scroll View content.
I decided to try the RenderTexture route since it seems to be more flexible. In some cases I need to be able to draw partial pieces of images and stuff for doors. Plus creating individual (possibly hundreds) of UI Image objects seemed like a bad idea.
I'm using Graphics.DrawTexture after using Graphics.SetActive to change the active render texture.
Is there an easier way to do this?
Your answer
![](https://koobas.hobune.stream/wayback/20220613033837im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Correct way to draw on screen for 2D game 1 Answer
Assigning UV Map to model at runtime 0 Answers
Graphics.Blit or texture update how long to draw to entire screen? 0 Answers
How to do make up using brush to draw sprite and remove using shower? 2 Answers
Trying to use Graphics.DrawTexture() to modify my texture 1 Answer