Search Unity

Environment reflection probe forced update?

Discussion in 'Scripting' started by headlessstudio, Mar 30, 2019.

  1. headlessstudio

    headlessstudio

    Joined:
    Feb 25, 2016
    Posts:
    83
    I've been trying to force an update on the environment reflection probe but without success, it seems that once its calculated it stores it in the cache and then there's no way to force update it.

    It works if my skybox material has a file in it and I update the file, but it does not work when I have a texture2d or rendertexture in my skybox material, this seems to be the main issue, something is not triggered when we update the texture 2d and it's triggered when a file is changed on disk.

    I'm already using DynamicGI.UpdateEnvironment() and it works great for the lighting but no avail on the reflection.

    Any ideas?

    Thanks in advance,
    Artur Leao
     
  2. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,357
    Not sure if this is what you looking for.Updates standard reflection probes not sure if that is what you refer to with envirnoment reflection probe.


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class refprobe : MonoBehaviour {
    6.  
    7.  
    8.     public ReflectionProbe ef;
    9.     RenderTexture targetTexture;
    10.  
    11.     void Start () {
    12.  
    13.     }
    14.      void Update ()
    15.     {ef.RenderProbe(targetTexture = null);
    16.  
    17.     }
    18. }
     
  3. headlessstudio

    headlessstudio

    Joined:
    Feb 25, 2016
    Posts:
    83
    Not really. That's for a scene reflection probe, I'm looking into how to update the environment one (located on lightsettings).

    Thanks
     
  4. josefgrunig

    josefgrunig

    Joined:
    Jan 23, 2017
    Posts:
    62
    @headlessstudio did you find a way to update an environment reflection probe?