- Home /
Question by
Cody · Jul 26, 2011 at 08:01 PM ·
textureterrainrenderrender texturenot rendering
Render texture is not rendering Terrain
I have a mini map that it using a render texture for the OnGUI function. The texture is fine when I look at it in the inspector but it's not showing up in the game view. Apparently this is a bug. I've tried using Graphics.DrawTexture but that doesn't seem to work either. If anyone has any ideas that would be awesome.
P.S I have to use OnGUI.
Thank you.
Comment
Answer by YikYikHeiHei · Jul 27, 2011 at 11:26 AM
Are you prass the play button?
If you not to prass that.
Or if you want to preview but not prass the play button, you can add this to you script in top.
@script ExecuteInEditMode()
Answer by Tabu · Dec 15, 2011 at 09:38 PM
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 ()
{
Graphics.DrawTexture(new Rect(100,100, 128, 128),aTexture, aMaterial);
}
}