How do I end a level and start another by score or by surviving?,How do I end a level by timer or score?

I’m trying to transition levels on whether the player reaches a certain score or stays alive for a certain amount of time. Thanks!,I would like my game to progress through the levels as the player reaches a certain score or has survived for a certain amount of time.

Just check for your chosen variable to reach a certain value and then load the other level (scene). All of this in the update function:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class ExampleClass : MonoBehaviour {

	int score;

	void Update () 
    {
		if(score==100)
		{
			SceneManager.LoadScene("NextLevel");
		}
	}
}

This is what I have for it to load the next level. The code is added to an empty game object (GameController). All levels are in the buildindex.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class NextLevelScore : MonoBehaviour
{

    

        private int score;

        void Update()
        {
            if (score==100)
            {
            SceneManager.LoadScene("Level2");
        }
        }
    }

Also I have tried the following:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class NextLevelScore : MonoBehaviour
{

    

        private int score;

        void Update()
        {
            if (score==100)
            {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
        }
        }
    }