お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseOnPostRenderはカメラがシーンのレンダリングを完了した後に呼び出されます
この関数は、この関数が記述されたスクリプトにCameraがアタッチされていて有効である場合のみ呼び出されます。 OnPostRenderは関数の中にシンプルなyield文を使用して、コルーチンにすることができます。 OnPostRenderはカメラがすべてのオブジェクトをレンダリングした後に呼び出されます。 全てのカメラとGUIのレンダリング後に何かを行いたい場合は、WaitForEndOfFrame コルーチンを使用してください。 See Also: OnPreRender, WaitForEndOfFrame.
// When attached to a camera, will clear alpha channel // of camera's render texture to pure white. // Useful if you have camera rendering into a texture and later // want to display it in GUI. private var mat : Material; function OnPostRender() { // Create a shader that renders white only to alpha channel if(!mat) { mat = new Material( "Shader \"Hidden/SetAlpha\" {" + "SubShader {" + " Pass {" + " ZTest Always Cull Off ZWrite Off" + " ColorMask A" + " Color (1,1,1,1)" + " }" + "}" + "}" ); } // Draw a quad over the whole screen with the above shader GL.PushMatrix (); GL.LoadOrtho (); for (var i = 0; i < mat.passCount; ++i) { mat.SetPass (i); GL.Begin( GL.QUADS ); GL.Vertex3( 0, 0, 0.1 ); GL.Vertex3( 1, 0, 0.1 ); GL.Vertex3( 1, 1, 0.1 ); GL.Vertex3( 0, 1, 0.1 ); GL.End(); } GL.PopMatrix (); }