Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: get hard disk serial number 
Csharp :: int to ascii c# 
Csharp :: httppostedfilebase in .net core 3.1 
Csharp :: c# datagridview column size 
Csharp :: unity spherecast 
Csharp :: convert generic to type c# 
Csharp :: convert json to list object c# 
Csharp :: triangle minimum path sum 
Csharp :: debug c# console 
Csharp :: unity c# 
Csharp :: make folder with c# 
Csharp :: how to access individual characters in a string in c# 
Csharp :: how to make a mouse down condition in C# 
Csharp :: how to make a global string c# 
Csharp :: c# remove duplicates from datatable 
Csharp :: create list with values c# 
Csharp :: c# current dir 
Csharp :: what is public static void 
Csharp :: unit test throw exception c# xunit 
Csharp :: how to close an application in c# 
Csharp :: switch case c# contains 
Csharp :: bitmap to imagesource c# 
Csharp :: c# create list with range 
Csharp :: c# enum to int array 
Csharp :: how to reference a UI element in unity 
Csharp :: asp.net core get root url in view 
Csharp :: badlion 
Csharp :: csharp datagridview filter column 
Csharp :: route attribute controller with parameter asp.net core 
Csharp :: change image of button c# 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =