I’m making a minimap for a game…
I created new camera, attached rendertexture to it and if I try to add the rendertexture to a gameobject then terrain and everything else shows perfectly but…
I want to have a 2D minimap, so I tried adding new GUI Texture into game and placed rendertexture in Texture position, but it only renders game objects, where as Terrain is invisible, it doesn’t show up
Do you need a map like on a road map or a gps? or do you want a realTime video clip from the top of the character’s head?
What about making a screenshot (cmd+shift+4) from inside the editor you then use as the texture of a plane you put under the terrain. Then simply change the layers of the object and the ones the main camera shows, so that in normal view, you can’t see the plane with the map on it, but it’s rendered by your map camera…
Umm It’s more of a GPS lol, basically I added the camera much higher than the character and it will render the character from top, following it everywhere.
Simple minimap
It works perfectly, just that the terrain isn’t being rendered :S
I has this exact same issue but found a solution (or what I think was the solution). Inside you OnGUI function instead of using GUI.DrawTexture do a Graphics.DrawTexture(…). This will also allow you to apply a shader to the texture so you can make your mini map any shape.
Or simply use a second camera that you can place over your character. Then you’ll have to adjust position and resolution of this camera, I already took this for minimaps in my own levels. The camera’s output images should then show up at the border of the screen and render everything, included the terrain.
(Why do you want to use a render texture, if there are other very basic methods?)
You might not need to use a GUITexture to make a car mirror. The Camera class has a rect variable that determines where on the screen the camera will render. You can set the mirror camera so that it renders to a small, mirror-shaped rectangle rather than the whole screen.
I’ve just run into this problem. It looks as though the GUI/Text Shader doesn’t render terrain. I’d presume that’s the shader when one uses any GUI methods to draw a RenderTexture. The workarounds mentioned (Graphics.DrawTexture, using the view port rect) work, but I plan to file a bug report anyway.
Great one! [quote=“anon_72746843, post:15, topic: 398579, username:anon_72746843”]
Try using this code. Make sure to set the Material to Unlit/Texture, if you use the normal Diffuse, this will not work!!
using UnityEngine;
using System.Collections;
public class MinimapTest : MonoBehaviour
{
public Material aMaterial;
public Texture aTexture;
void OnGUI ()
{