Hello all,
I have been trying to figure out for a day now how to press a button and have the panel fade to black AND THEN load the scene.
I have no problems fading in or out at all, it's the instant jump on Appliction.LoadLevel before the tween can play. Is there a way to have it wait for the fade to finish first?
I have looked and searched everywhere. If there is a way and somebody could be kind enough to explain it in C# terms (as this is the language I am learning) I would be eternally grateful.
Apologies for my ignorance. I've searched all day for the answer to this and any topics discussing anything remotely close to this has been out of my scope of understanding.
EDIT :
I have accomplished this but is this considered correct?
using UnityEngine;
using System.Collections;
public class StartButton : MonoBehaviour {
public string levelName; //Scene to load
public GameObject fader; //Fading Object (Right now it's a black sprite)
void OnClick()
{
TweenAlpha.Begin (fader, 1, 1);
Invoke("LoadScene", 1);
}
void LoadScene() {
Application.LoadLevel(levelName);
}
}