Im still pretty new to the coding side of unity and im working on a lightswitch were it will turn off and on the light and then update the reflection prob of the room to match the new lighting but when i flip the switch it updates the probe before the light can even turn off. and the question is how would i delay the update of it. here is the code so far.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class lightswitch : MonoBehaviour {
public Light Light;
public GameObject goLightSwitch;
public ReflectionProbe Probe;
int renderID = -1;
private bool _switchOn;
void OnMouseDown()
{
if(_switchOn)
{
_switchOn = false;
Light.enabled = false;
renderID = Probe.RenderProbe ();
}
else if (!_switchOn)
{
_switchOn = true;
Light.enabled = true;
renderID = Probe.RenderProbe ();
}
}
}