Hey guys.
Iam working on a version of Block Breaker so Iam posting my question here:
Iam trying to make a splash screne that fades in and out. In the Unity course everything was just fine and dandy, but I upgraded my project to Unity5 and Iam having some issues with the fade in / fade out thingy.
Unity5 does not use Application. anymore. Instead it uses SceneManager. Now I want my splash screne to load the next level(screne) once it fades out. My code:
void Update () {
if(Time.timeSinceLevelLoad < timeToFade){
// FADE IN
}else{
gameObject.SetActive(false);
}
bool splashPanel = (this.tag == "SplashPanel");
if(splashPanel){
gameObject.SetActive(true);
Invoke("FadeOut",2.5f);
int indexSC = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene(indexSC+1);
The problem here is that when I press play, the next scene loads right away. There is no splash screne to be seen. And it doesn’t even invoke the loading. Why does half the code get ignored and how can I solve this so its working the way I want it.
Many thanks!