x


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.

more ▼

asked Jul 26 '11 at 08:01 PM

Cody gravatar image

Cody
1 2 3 3

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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()
more ▼

answered Jul 27 '11 at 11:26 AM

YikYikHeiHei gravatar image

YikYikHeiHei
311 8 9 13

(comments are locked)
10|3000 characters needed characters left

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);

    }
}
more ▼

answered Dec 15 '11 at 09:38 PM

Tabu gravatar image

Tabu
176 23 26 38

Works perfectly for me! Thanks =)

Apr 21 '12 at 06:49 PM SimplyZ
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2207
x1478
x266
x15
x4

asked: Jul 26 '11 at 08:01 PM

Seen: 1408 times

Last Updated: Apr 21 '12 at 06:49 PM