Camera.OnPreRender 在渲染之前

function OnPreRender () : void

Description描述

OnPreRender is called before a camera starts rendering the scene.、

OnPreRender在相机开始渲染场景之前调用。

This message is sent to all scripts attached to the camera.

这个消息被发送到所有附加在相机上的脚本。

Note that if you change camera's viewing parameters (e.g. fieldOfView) here, they will only take effect the next frame. Do that in OnPreCull instead.

注意如果你在这里改变了相机的视野参数(例如fieldOfView),它们将只影响下一帧,OnPreCull 用代替。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	private bool revertFogState = false;

	void OnPreRender() {

		revertFogState = RenderSettings.fog;

		RenderSettings.fog = enabled;

	}

	void OnPostRender() {

		RenderSettings.fog = revertFogState;

	}

}
// This script lets you enable/disable fog per camera.

//这个脚本让你在每个相机开启/禁用雾效

// by enabling or disabling the script in the title of the inspector

//在检视面板开启或禁用这个脚本

// you can turn fog on or off per camera.

//在每个相机可以开启/禁用雾效

private var revertFogState = false;



function OnPreRender () {

	revertFogState = RenderSettings.fog;

	RenderSettings.fog = enabled;

}



function OnPostRender () {

	RenderSettings.fog = revertFogState;

}
Page last updated: 2011-3-7