problem with text blinking

I’m having a problem to create the text that says press any button and making it blink. i have create the background and the text but i can’t set its position. i’m doing it in C#. here is my code

using UnityEngine;
using System.Collections;

public class MainMenu : MonoBehaviour {
public GUITexture guiTexture;
private int GuiLabel = false;

void OnGUI(){
CreateBackgroundBox();
GuilabelStart();

if (displayLabel == true)

GUILayout.Label(“Press Any Button”);

}

private void CreateBackgroundBox(){
GUI.Box(new Rect(0, 0, Screen.width, Screen.height), “”);
}

private int GuilabelStart(){
while(1){
GuiLabel = true;

yield return new WaitForSeconds(.5);

GuiLabel = false;

yield return new WaitForSeconds(.5);

}
}

}

also in the part private int GuilabelStart(){ it says that it shouldn’t be an int

Yeah, false isn’t an integer. It’s a bool (or boolean).

GUILayout exists specifically so you don’t have to tell it the position. Use GUI for exact positioning. First two arguments to the Rect are the X and Y position.

You’re starting GUILabelStart every OnGUI call, which is going to hurt. You need to call it only once, since it runs on its own forever.

Ok, i’ll try it , thanks. i have another question is it better if you do it in JavaScript?

I’d recommend sticking with C#.

The only thing Unity’s ‘Javascript’ has that’s “better” than C# is you can have ‘duck typing’ -

var x; // x can be of any type