添加一个委托,以便在默认镜面反射立方体贴图发生更改时收到通知。
其他资源: ReflectionProbe.
using UnityEngine; using UnityEngine.Rendering;
public class ReflectionProbeManager : MonoBehaviour { private static void OnSetDefaultReflection(Texture cubemap) { Debug.Log("Default reflection cubemap was changed."); }
void Start() { ReflectionProbe.defaultReflectionTexture += OnSetDefaultReflection; }
void OnDestroy() { ReflectionProbe.defaultReflectionTexture -= OnSetDefaultReflection; } }