Hi,
I’ve got a simple fade out script, and it works well, and I can track the alpha, it goes from 0 to the end. I’ve set the ‘if statement’ to cut a bit earlier as well, yet it’s not jumping to my next scene.
Pretty confused really.
Any insight would be great thanks!
public class EndLevelTrigger : MonoBehaviour {
bool fadetoblack = false;
void OnTriggerEnter(Collider other)
{
if (other.tag == "Player") {
fadetoblack = true;
}
}
void FadeToBlack()
{
guiTexture.color = Color.Lerp (guiTexture.color, Color.black, 0.1f * Time.deltaTime);
if (guiTexture.color.a >= 214f) {
Application.LoadLevel(1);
}
}
void Update()
{
if (fadetoblack) {
FadeToBlack();
}
}
}