- Home /
This question was
closed Mar 13, 2014 at 09:15 PM by
Graham-Dunnett for the following reason:
Too subjective and argumentative
Question by
Exviscerous · Mar 12, 2014 at 11:30 PM ·
c#noob
I am a serious novice at c# and need help
i have this script to allow me to click on an object, get a message, and click again to close it. i need to somehow fit a command in it to change the GUIStyle. here is my script, anyone who could fill in the command i need would be my new best friend.
using UnityEngine;
using System.Collections;
class ShowTextButton1 : MonoBehaviour
{
public string title = string.Empty;
private bool showText = false;
public Texture2D background;
private GUIStyle style = null;
private void InitStyle()
{
if (style != null) return;
style = new GUIStyle(GUI.skin.button);
if (background != null) style.normal.background = background;
}
void OnMouseDown()
{
if(!showText)
showText = true;
}
void OnGUI()
{
if(showText)
{
if(GUI.Button(new Rect(100,170,400,60), title))
showText = false;
}
}
}
Comment