load scene unity
using UnityEngine.SceneManagement
public class LoadScene : MonoBehavior
{
public string sceneToLoad = "Level2";
public void Start()
{
SceneManager.LoadScene(sceneToLoad);
}
}
load scene unity
using UnityEngine.SceneManagement
public class LoadScene : MonoBehavior
{
public string sceneToLoad = "Level2";
public void Start()
{
SceneManager.LoadScene(sceneToLoad);
}
}
Unity c#loading a scene after a few seconds
void Start()
{
//Start the coroutine we define below named ChangeAfter2SecondsCoroutine().
StartCoroutine(ChangeAfter2SecondsCoroutine());
}
IEnumerator ChangeAfter2SecondsCoroutine()
{
//Print the time of when the function is first called.
Debug.Log("Started Coroutine at timestamp : " + Time.time);
//yield on a new YieldInstruction that waits for 2 seconds.
yield return new WaitForSeconds(2);
//After we have waited 2 seconds print the time again.
Debug.Log("Finished Coroutine at timestamp : " + Time.time);
//And load the scene
Application.LoadLevel("Game"); //<-- This is the correct name of the scene
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us