using GUI functions inside of a public function

Okay… I’ll make this short sweet and to the point… The title says it all I’m trying to use GUI.DrawTexture in a function of my own…
in other words

function OnGUI(){
GUI.DrawTexture(Rect(0,0,10,10),thetexture);//this works
}
public function toodles(){
GUI.DrawTexture(Rect(0,10,10,10),Theothertexture);//this dosent
}

I guess I’m just crazy…

Any function using GUI.x code must be called from OnGUI.

–Eric

Adding to what Eric5h5 said, the following code would work:

function OnGUI(){ 
GUI.DrawTexture(Rect(0,0,10,10),thetexture);//this works 
toodles(); //calling the toodles function from within OnGUI() will also work
} 

public function toodles(){ 
GUI.DrawTexture(Rect(0,10,10,10),Theothertexture);//this dosent 
}

Thanks a bunch guy’s I was wondering why some of my functions worked and some other ones didn’t…
Thanks again helped a lot.