- Home /
Trying to create two consecutive time delays
Hey Guys,
I'm working on a splash screen for my game. The result that I'm trying to achieve is it's just black for 2 seconds, then it fades in to the logo, holds on that for 3 seconds, and then fades to black and loads the main menu scene.
Here's what I tried:
void Start()
{
Startcoroutine(Splash(2f, 3f));
}
IEnumerator Splash(float duration1, float duration2)
{
yield return new WaitForSeconds(duration1);
yield return StartCoroutine(SM.scenLoader.Fade(0f));
yield return new WaitForSeconds(duration2);
SM.sceneLoader.LoadScene("menu");
}
As you may have guessed, that first delay never happens. It just immediately fades in, shows the logo for 3 seconds, and then fades to black and loads the next scene.
Does anyone know how I can create a delay BEFORE the initial fade in?
just fyi there is a splash screen thing built in Unity. here is the documentation. https://docs.unity3d.com/$$anonymous$$anual/class-PlayerSettingsSplashScreen.html maybe this might be better?
That's Unity's splash screen, simply showing that the game is made with Unity. What I'm working on is a splash that follows that with my own logo.
Your answer
Follow this Question
Related Questions
Instantiate color change loop 0 Answers
run level for 4 minutes help 1 Answer
Corountines and messaging system 0 Answers
yield WaitForSeconds 3 Answers
Switching From one texture to another 3 Answers