How to update reflection probe's bakedTexture at runtime?

Hello forum, so I have an app that has some sort of real time day cyle which I am building for the Quest 2. To achieve this, I am doing some simple texture blending and for my lightmaps, I decided to simply multiply all the materials color to a given color for that day cycle.

The problem is how to update the reflection probe. I managed to make it work, but currently it is only working in the editor.

Right now I managed to achieve what I want by using the ReflectionProbe.BlendCubemap method, pass my renderTexture and then assign it to the bakedTexture.

Here is the result: Unity_DvJ30tu6he.mp4 - Google Drive

So I am wondering, is that the right way to do it? What should I do to make it work on the build?

Obs: I know there are some assets that do exactly that, I tried the MLS, but had some difficulties due to my project structure. It seems to have some problems with the way Unity arranges multi scenes.

Edit: Since it is now working I will leave my solution here:

Essentially I am blending the reflection probe’s cubemap using a render texture.

On Awake function I create a renderTexture at runtime:

And then this function updates the renderTexture based on a given float value:

8216136--1089873--upload_2022-7-24_19-0-11.png

So I figured out the problem. I created a blank URP project, brought my code to it and set all the VR stuff. It worked normally. Started checking setting by setting, realized that on Project Settings in the secion “Always included Shaders” I had only 2 on my project, while the URP blank project includes 10 by default. Anyways, basically you need to include these if you want to do Cubemaps blending:

1 Like