Displaying a PNG on lap finish (racing game)

Hi folks,

We've nearly finished our rracing game for a final year University project and we're a bit stuck.

We're programming in javaScript and I need to know how to do the following:

We have a lap timer, and the player has to complete two laps. We're going to award a gold medal for <6min laps, silver for 6-6;30 laps and bronze for >6:30 laps. These images will just pop up on the screen and give the user an option to quit to the main menu or restart the level.

I have creted the medals as PNGs in photoshop and imported them into the project.

Any help would be appreciated.


Here is one way of doing it...


public Texture bronzeTexture;
public Texture silverTexture;
public Texture goldTexture;

public bool isRaceComplete = false;
public Medal medal = Medal.None;

// Or whatever... If you have several resultions, then its may be better to do it with Screen.width, Screen.height...
public Rect rect = new Rect(0.0f, 0.0f, 32.0f, 32.0f);

function OnGUI()
    if (isRaceComplete)
        if (medal == Medal.Bronze)
            GUI.DrawTexture(rect, bronzeTexture);
        else if (medal == Medal.Silver)
            GUI.DrawTexture(rect, silverTexture);
        else if (medal == Medal.gold)
            GUI.DrawTexture(rect, goldTexture);

        // Add other options...

public enum Medal