Hi,
I am trying to make a between scene fader. It works fine in the Editor and Game mode, but it doesnt work on some computers. The scene stays black when loaded.
My setup is:
I put an UI Image and change the alpha value.
Here is my script:
using UnityEngine;
using System.Collections;
public class fading : MonoBehaviour {
public Texture2D texture;
public float fadeSpeed = 0.8f;
public player p;
public UnityEngine.UI.Image t;
int drawDepth = -1000;
float alpha = 1.0f;
int fadeDir = -1;
void Update(){
fade ();
}
void fade(){
alpha += fadeDir * fadeSpeed + Time.deltaTime;
alpha = Mathf.Clamp01 (alpha);
t.color = new Color(t.color.r, t.color.b, t.color.g, alpha);
}
public float BeginFade(int direction){
fadeDir = direction;
return (fadeSpeed);
}
void OnLevelWasLoaded(){
//Debug.Log ("ABC");
BeginFade (-1);
Cursor.visible = false;
}
}
THANKS ![]()