Quick question.
If i Have a menu f.e. a build menu and i would like to show all 3D buildings in that menu without the need to create images for each individual building.
I have heard now of two possible solutions:
- Create a screenshot of each individual building and use it as texture
- Use Render Textures by assigning a camera to look at an instantiated building and render this onto a texture.
I wanted to try out option 2. However I was wondering, if I have 20 buildings, would i need to instantiate all 20 buildings outside of the screen and create 20 cameras which each looks at an individual building ?
This will I think need a scripted solution if you only want 1 camera.
If you create a component to act as a render texture cache. I.e. Has a property to contain the render textures, you can then create them on the fly using.
You can then assign these created “cache” render texture to the Building render camera when you want want it. You might have to wait a frame or two for the texture to appear of course (depending upon camera and overlays). Once you have it, you can then reference this render texture in your UI (i.e. Assign it to the relevant UI image component).
You’ll need to think about managing these textures (I’m guessing you only want 1 per building, not per in game instance of a building) so you might want to think about that and perhaps have singular component in the scene to act as the building image render target cache (with an array of script created Render Textures).