- Home /
GUI Info button not displaying
Hi all.
var firstTexture: Texture;
var Map1 : Texture;
function OnGUI() {
if (GUI.Button(Rect(10,15,50,50),firstTexture))
Debug.Log("Clicked the button with an image");
if (GUI.Button(Rect(5,75,60,30),"Danger")){
Debug.Log("Clicked the button with text");
renderer.material.mainTexture=map1;
}
}
This script is working this way but when I try to add an info button for example when you click the button with text, it doesn't show. Now, maybe I'm writting the function not properly which is most likely happening. Can anyone point me on how to make the multiline text field here? Also tried the text field from the reference but didn't work out. Thanks.
Answer by SisterKy · Aug 07, 2011 at 08:54 PM
var **M*ap1 : Texture;
renderer.material.mainTexture=m*ap1;
see a difference? ;)
I'm surprised you aren't getting any errors??
Not sure if this is necessary but I think you should better use Texture2d for gui-elements (for firstTexture)
Greetz, Ky.
Yeah see the difference although I don't know how I'm not getting errors. Anyway, what I wanted was creating a text field or a text bar with info.