Camera翻译:Yīm
- actualRenderingPath
- allCameras
- aspect
- backgroundColor
- cameraToWorldMatrix
- clearFlags
- CopyFrom
- cullingMask
- current
- depthTextureMode
- depth
- farClipPlane
- fieldOfView
- layerCullDistances
- main
- nearClipPlane
- OnPostRender
- OnPreCull
- OnPreRender
- OnRenderImage
- OnRenderObject
- OnWillRenderObject
- orthographicSize
- orthographic
- pixelHeight
- pixelRect
- pixelWidth
- projectionMatrix
- rect
- renderingPath
- RenderToCubemap
- RenderWithShader
- Render
- ResetAspect
- ResetProjectionMatrix
- ResetReplacementShader
- ResetWorldToCameraMatrix
- ScreenPointToRay
- ScreenToViewportPoint
- ScreenToWorldPoint
- SetReplacementShader
- targetTexture
- velocity
- ViewportPointToRay
- ViewportToScreenPoint
- ViewportToWorldPoint
- worldToCameraMatrix
- WorldToScreenPoint
- WorldToViewportPoint
Camera.OnWillRenderObject 在渲染物体之前
function OnWillRenderObject () : void
Description描述
OnWillRenderObject is called once for each camera if the object is visible.
如果物体可见,每个相机都会调用OnWillRenderObject。
The function is called during the culling process just before rendering all culled objects. You might use this to create dependent render textures and you want to update the render texture only if the rendered object will actually be visible. As an example this is used by the water component.
这个函数在消隐过程中调用,在渲染所有被消隐的物体之前被调用。可以用这个来创建具有依赖性的渲染纹理,只有在被渲染的物体可见时才更新这个渲染纹理。作为一个例子,水组件就使用了这个。
Camera.current will be set to the camera that will render the object.
Camera.current 将被设置为要渲染这个物体的相机。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public GameObject otherObject;
void OnWillRenderObject() {
otherObject.transform.localScale *= 1.0001F;
}
}
// Increases the size of otherObject while this transform is being rendered.
//增加otherObject的大小同时这个变换正在渲染
// Be aware that this will be called even if the Scene Editor displays the object
//注意这个将被调用即使场景编辑器显示这个物体
// So make sure to not see the object either in the game view nor the scene editor.
//因此,请确保在游戏视图看不到的物体,不在场景编辑器
var otherObject : GameObject;
function OnWillRenderObject() {
otherObject.transform.localScale *= 1.0001;
}
最后修改:2011年3月7日 Monday 16:30