i have GUI button and GUI texture. when i press gui button i want my guiTexture to show and stay on screen for 3 seconds then disappear. how would i do that with C# in unity? i am making 2D game. i have code for button and C# script code as well.
right now when i click on button guitexture will only stay as long as button is pressed. but i want to stay texture on 3 seconds and then disappear.
using UnityEngine;
using System.Collections;
public class Q3 : MonoBehaviour {
public GUISkin skin = null ;
public GUITexture guiTextureWrong;
//public Texture2D wronganswer;
void OnGUI () {
GUI.skin = skin ;
guiTextureGun.enabled= false;
// first button. If it is pressed, Application.Loadlevel (1) will be executed
if(GUI.Button(new Rect(Screen.width * .05f,Screen.height * .15f,320,100), "Orange")) {
Application.LoadLevel("");
}
if(GUI.Button(new Rect(Screen.width * .05f,Screen.height * .45f,320,100), "Apple" )) {
Application.LoadLevel("Question4");
}
if(GUI.Button(new Rect(Screen.width * .05f,Screen.height * .30f,320,100), "Mango" )) {
guiTextureWrong.enabled= true;
}
if(GUI.Button(new Rect(Screen.width * .05f,Screen.height * .60f,320,100), "Banana" )) {
Application.LoadLevel ("");
}
}
}