Issues printing a float to the screen.

I’m currently using this code to print things out to a screen:

// This is in an UpdateScript.js attached to the camera

#pragma strict

function OnGUI()
{
    GUI.Label(Rect(10, 10, 120, 20), "Bottom paddle: " + PlayerPaddleBehaviorScript.goalCounter.ToString());
    GUI.Label(Rect(10, 25, 120, 20), "Special Meter: " + PlayerPaddleBehaviorScript.specialMeter.ToString());

    GUI.Label(Rect(10, 45, 120, 20), "Left paddle: " + PaddleLeftBehaviorScript.goalCounter.ToString());
    GUI.Label(Rect(10, 60, 120, 20), "Special Meter: " + PaddleLeftBehaviorScript.specialMeter.ToString());

    GUI.Label(Rect(10, 80, 120, 20), "Right paddle: " + PaddleRightBehaviorScript.goalCounter.ToString());
    GUI.Label(Rect(10, 95, 120, 20), "Special Meter: " + PaddleRightBehaviorScript.specialMeter.ToString());

    GUI.Label(Rect(10, 115, 120, 20), "Top paddle: " + PaddleTopBehaviorScript.goalCounter.ToString());
    GUI.Label(Rect(10, 130, 120, 20), "Special Meter: " + PaddleTopBehaviorScript.specialMeter.ToString());
}

And this is the code that manipulates the specialMeter variables:

// This is in each paddle behavior script (PlayerPaddleBehaviorScript, PaddleTopBehaviorScript, etc.)

static var specialMeter : float = 0;
static var specialMeterFull : float = 1.0f;
static var goalCounter : int = 20;

function OnCollisionEnter(collision : Collision)
{
    if (specialMeter < specialMeterFull)
    {
        specialMeter += 0.1f;
    }
}

It works fine initially, but then once the specialMeter gets to 0.8f and 0.9f, it’s blank. Then once it reaches 1, it shows again. Is this a bug, or am I doing something wrong without realizing?

Try making your rect wider.

–Eric