private void UpdateProbes()
{
if (debug) Debug.Log("Update Probes: " + time + ":" + probesLastUpdated);
foreach (var reflectionProbe in probes) {
if (reflectionProbe != null) {
if (!Application.isPlaying) {
reflectionProbe.refreshMode = ReflectionProbeRefreshMode.OnAwake;
reflectionProbe.RenderProbe();
// TODO Hack to get it to properly refresh probes in Editor when not playing by toggling refreshMode
}
if (reflectionProbe.refreshMode != ReflectionProbeRefreshMode.ViaScripting)
reflectionProbe.refreshMode = ReflectionProbeRefreshMode.ViaScripting;
/*
AllFacesAtOnce Instructs Unity to use time-slicing by first rendering all faces at once, then spreading the remaining work over the nex 8 frames. Using this option, updating the probe will take 9 frames.
IndividualFaces Instructs Unity to spread the rendering of each face over several frames. Using this option, updating the cubemap will take 14 frames. This option greatly reduces the impact on frame rate, however it may produce incorrect results, especially in scenes where lighting conditions change over these 14 frames.
NoTimeSlicing Unity will render the probe entirely in one frame.
*/
reflectionProbe.timeSlicingMode = timeSliceProbes;
// Only update probe if it doesnt have a customBakedTexture
if (reflectionProbe.customBakedTexture == null) {
reflectionProbe.RenderProbe();
//Debug.Log("Probe update: " +reflectionProbe.name,reflectionProbe );
}
}
}
}