Version: 2020.1

ReflectionProbe.IsFinishedRendering

切换到手册
public bool IsFinishedRendering (int renderId);

参数

renderId RenderProbe 方法返回的表示 RenderID 的整数。

返回

bool 如果渲染已完成,则返回 true,否则返回 false。

另请参阅:timeSlicingMode

描述

检查探针是否已完成时间切片渲染。

using UnityEngine;
using System.Collections;

public class UpdateProbeEvery2Seconds : MonoBehaviour { private int RenderId = -1; private ReflectionProbe TheProbe; public RenderTexture TargetTexture;

IEnumerator 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) { yield return new WaitForSeconds(2.0f);

// render the probe over several frames and blit into TargetTexture once finished. RenderId = TheProbe.RenderProbe(TargetTexture); } }

void Update() { if (TheProbe.IsFinishedRendering(RenderId)) { // Probe has finished rendering, do something with the render texture } } }