how to make a highscore screen?

Hi everyone, I was wondering if you could help me in making a high score screen which displays the time it takes to complete the game.

Thanks in advance

Your question is really too general. Essentially your asking someone to program an entire feature rather than a problem space. To get you in the right direction, you’ll need a few things.

  1. A camera the has a GUI layer
  2. A script that overrides the OnGUI() function
  3. The script is attached to something in game, so that the OnGUI() runs

How you implement OnGUI() will dictate what the player sees, but I’ll recommend that you have a boolean variable to allow yourself to toggle visibilty of the window. Here is a super simple snippet to get you started:

const int SCORE_WINDOW_ID = 1;
Rect scoreScreenRect = new Rect(20,20,400,400);
bool showScoreScreen;

void OnGUI() {

  if(showScoreScreen) {
    scoreScreenRect = GUI.Window(SCORE_WINDOW_ID ,scoreScreenRect, ScoreScreen, "Scores");
   
  }
}

void ScoreScreen(int id) {
    GUI.Label(new Rect(50,50,100,50), "Player Score Here");
}