- Home /
Reflection probes not updating
Very simple, but very strange. I have a reflection probe set to update realtime via script. I have a script attached to the same object that updates the reflection probe every 5 seconds. The problem is, the code doesn't seem to trigger the probe. I'm not sure what's wrong. Here's the code:
var r : ReflectionProbe;
var w : boolean;
function Awake() {
r = GetComponent(ReflectionProbe);
}
function FixedUpdate() {
WaitAndBake();
}
function WaitAndBake() {
if(!w) {
w = true;
r.RenderProbe();
yield WaitForSeconds(5);
w = false;
}
}
One of the inputs on the r.RenderProbe() function is a render texture, but it doesn't seem like that should be necessary (It doesn't give me any script errors for not having it there, and I don't even know what a render texture IS..). Does it need one? If so, what IS a render texture? Is it the texture the probe replaces when it renders? If so, why doesn't it give me an error when I don't have one?
P.S. It's really annoying when I want to figure something out with these but all I find is "how to use reflection probes" and "how to use reflection probes" and "how to use reflection probes" and "how to use reflection probes" ... You get the idea. Somehow no one has ever had problems with these? I don't believe it.
Answer by graphicDNA · Jul 05, 2019 at 05:40 PM
If you are using HDRP (and maybe other Scriptable Rendering Pipelines), Reflection Probes are overridden by newer classes (search for UnityEngine.Experimental.Rendering.HDPipeline.HDProbe.cs).
They behave differently, and RenderProbe method won't work with those. Instead, you have to use the following helper method:
HDAdditionalReflectionDataExtensions.RequestRenderNextUpdate(reflectionProbe);
Please note: The HDAdditionalReflectionDataExtensions class is in the UnityEngine.Experimental.Rendering.HDPipeline namespace. You will also need to configure your probe as RealTime, and realtime mode should be set to OnDemand.
Hope it helps.
F$$anonymous$$'ING THAN$$anonymous$$ YOU!
I've been searching high / low for this see$$anonymous$$gly simple thing. Finally, I can go to bed....
BTW, although appreciated the other suggestions didn't work for me, this one did the trick!
Answer by Zogg · May 04, 2016 at 04:13 PM
I had a problem with a RenderProbe() that didn't seem to work. I solved the problem by switching the time slicing mode to "No time slicing". The other two slicing modes don't seem to work with RenderProbe().