Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Refresh reflection probe

Discussion in 'Scripting' started by tawdry, Jun 15, 2018.

  1. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,080
    Hi
    How do you tell the probe to refresh via scripting I can't find a code example anywhere least not one that works tried a few variations on the unity manual example but none work.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class refprobe : MonoBehaviour {
    6.    
    7.     // Use this for initialization
    8.     void Start () {
    9.        
    10.     }
    11.    
    12.     // Update is called once per frame
    13.     void Update () {
    14.         ReflectionProbe.RenderProbe(RenderTexture = null);
    15.  
    16.     }
    17. }
    18.  
     
  2. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,080
    Ok figured it out so anyone else who need to do this here is the script how to
    Just drag the relevant probe into the public slot.Not at all optimised just wanted to get it working first.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class refprobe : MonoBehaviour {
    6.     public ReflectionProbe ef ;
    7.  
    8.     // Use this for initialization
    9.     void Start () {
    10.        
    11.     }
    12.    
    13.     // Update is called once per frame
    14.     void Update ()
    15.     {
    16.         //ef.refreshMode=1;
    17.         ef.RenderProbe(targetTexture = null);
    18.    
    19.     }
    20. }
     
  3. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,080
    Is there a way to add an object to the reflection probe without having to redo the entire probe area.Lets say a npc walks into frame i just want to render him new but keep the already rendered from before?