摄像机淡入淡出的例子

public var fadeOutTexture : Texture2D;
public var fadeSpeed = 0.3;
var drawDepth = -1000;
private var alpha = 1.0;
private var fadeDir = -1;

function OnGUI()
{
    alpha += fadeDir * fadeSpeed * Time.deltaTime; 
    alpha = Mathf.Clamp01(alpha);  
    GUI.color.a = alpha;
    GUI.depth = drawDepth;
    GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), fadeOutTexture);
}

function fadeIn()
{
    fadeDir = -1;  
}

function fadeOut()
{
    fadeDir = 1;  
}

function Start()
{
    alpha=1;
    fadeIn();
}

原文地址:https://www.cnblogs.com/softimagewht/p/1891677.html