Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

MonoBehaviour.OnPostRender()

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual

Descripción

OnPostRender is called after a camera finished rendering the scene.

This function is called only if the script is attached to the camera and is enabled. OnPostRender can be a co-routine, simply use the yield statement in the function.

OnPostRender is called after the camera renders all its objects. If you want to do something after all cameras and GUI is rendered, use WaitForEndOfFrame coroutine.

See Also: OnPreRender, WaitForEndOfFrame.

no example available in JavaScript
using UnityEngine;

// A script that when attached to the camera, makes the resulting // colors inverted. See its effect in play mode. public class ExampleClass : MonoBehaviour { private Material mat;

// Will be called from camera after regular rendering is done. public void OnPostRender () { if (!mat) { // Unity has a built-in shader that is useful for drawing // simple colored things. In this case, we just want to use // a blend mode that inverts destination colors. var shader = Shader.Find ("Hidden/Internal-Colored"); mat = new Material (shader); mat.hideFlags = HideFlags.HideAndDontSave; // Set blend mode to invert destination colors. mat.SetInt ("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusDstColor); mat.SetInt ("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); // Turn off backface culling, depth writes, depth test. mat.SetInt ("_Cull", (int)UnityEngine.Rendering.CullMode.Off); mat.SetInt ("_ZWrite", 0); mat.SetInt ("_ZTest", (int)UnityEngine.Rendering.CompareFunction.Always); }

GL.PushMatrix (); GL.LoadOrtho ();

// activate the first shader pass (in this case we know it is the only pass) mat.SetPass (0); // draw a quad over whole screen GL.Begin (GL.QUADS); GL.Vertex3 (0, 0, 0); GL.Vertex3 (1, 0, 0); GL.Vertex3 (1, 1, 0); GL.Vertex3 (0, 1, 0); GL.End ();

GL.PopMatrix (); } }