值 | 当当前 RenderPipelineAsset 在帧之间发生更改时将执行的委托。第一个参数将是之前的 RenderPipelineAsset,第二个参数将是当前的 RenderPipelineAsset。用于创建当前RenderPipeline 的参数,用于渲染上一帧。 |
您可以使用此委托在当前 RenderPipelineAsset 在帧之间发生更改时调用自定义代码。
using UnityEngine; using UnityEngine.Rendering;
public class CurrentRenderPipelineAssetChangedExample : MonoBehaviour { void Start() { RenderPipelineManager.activeRenderPipelineAssetChanged += RenderPipelineManager_activeRenderPipelineAssetChanged; }
private void OnDestroy() { RenderPipelineManager.activeRenderPipelineAssetChanged -= RenderPipelineManager_activeRenderPipelineAssetChanged; }
private void RenderPipelineManager_activeRenderPipelineAssetChanged(RenderPipelineAsset from, RenderPipelineAsset to) { Debug.Log($"RenderPipelineAsset has changed {(from != null ? from.GetType().Name : "Built-In")} to {(to != null ? to.GetType().Name : "Built-In")}"); } }