Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ReflectionProbe.IsFinishedRendering

Switch to Manual
public function IsFinishedRendering(renderId: int): bool;

Parameters

renderIdAn integer representing the RenderID as returned by the RenderProbe method.

Returns

bool True if the render has finished, false otherwise. See Also: timeSlicingMode

Description

Checks if a probe has finished a time-sliced render.

#pragma strict
public class UpdateProbeEvery2Seconds {
	private var RenderId = -1;
	private var TheProbe;
	public var TargetTexture;
	function Start() {
		TheProbe = GetComponent.<ReflectionProbe>();
		// set the probe to render in time-slicing mode and make sure all faces of the cubemap render the same frame.
		TheProbe.timeSlicingMode = UnityEngine.Rendering.ReflectionProbeTimeSlicingMode.AllFacesAtOnce;
		while ( true ) {
			new WaitForSeconds(2.0f)// render the probe over several frames and blit into TargetTexture once finished.
			RenderId = TheProbe.RenderProbe(TargetTexture);
		}
	}
	function Update() {
		if (TheProbe.IsFinishedRendering(RenderId)) {
			// Probe has finished rendering, do something with the render texture
		}
	}
}