- Home /
Question by
matthew798 · Feb 04, 2014 at 01:35 AM ·
texturedrawgui.drawtexture
GUI.DrawTexture not drawing anything.
#pragma strict
var windowTexture : Texture;
function Start () {
}
function Update () {
GUI.DrawTexture(Rect(1,1,300,200), windowTexture);
}
Hey guys,
All i have is a skybox model and two cameras in the scene. I have no clue why my texture isnt drawing. Nothing at all shows up. What did I dooooo? :D
Comment
Answer by robertbu · Feb 04, 2014 at 01:35 AM
GUI.DrawTexture() must be executed inside of the OnGUI() function.
function OnGUI() {
GUI.DrawTexture(Rect(1,1,300,200), windowTexture);
}
#pragma strict
var windowTexture : Texture;
function Start () {
}
function Update () {
}
function OnGUI () {
GUI.DrawTexture(Rect(1,1,300,200), windowTexture);
}
So thats my code now, but still nothing. I read somewhere that OnGUI needs to be active in monodevelop?? Is this true? I've been looking around google but I cant find anything that helps. Thanks!
I just tested your script, and it worked fine. This script must be attached to a game object. Then you must drag and drop your texture onto the 'windowTexture' variable in the Inspector.
Your answer