Hi all,
There are no lights are used in our scene, objects in scene use shaders like diffuse, transparent/diffuse and Mobile/Diffuse, and actors use unlit/transparent cutout, is there any way to make the scene darker and actors unchanged, thanks in advance.
Use something like this.
alpha is the variable to make it darker.
using UnityEngine;
using System.Collections;
public class Fading : MonoBehaviour {
/// the texture that will overlay the screen. This can be a black image or a loading graphic
public Texture2D fadeOutTexture;
/// <summary>
/// the fading speed
/// </summary>
public float fadeSpeed = 0.5f;
///the texture's order in the draw hierarchy: a low number means it renders on top
private int drawDepth = -1000;
/// the texture's alpha value between 0 and 1
private float alpha = 1.0f;
void Start()
{
DontDestroyOnLoad(transform);
}
void OnGUI()
{
// set color of our GUI (in this case our texture). All color values remain the same & the Alpha is set to the alpha variable
GUI.color = new Color (GUI.color.r, GUI.color.g, GUI.color.b, alpha);
GUI.depth = drawDepth; // make the black texture render on top (drawn last)
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), fadeOutTexture); // draw the texture to fit the entire screen area
}
}