您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
880 B
36 行
880 B
using System;
|
|
using Cinemachine;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.HighDefinition;
|
|
|
|
[RequireComponent(typeof(CinemachineBrain))]
|
|
public class ResetVolumetricsOnCut : MonoBehaviour
|
|
{
|
|
CinemachineBrain m_Brain;
|
|
|
|
void OnEnable()
|
|
{
|
|
m_Brain = GetComponent<CinemachineBrain>();
|
|
m_Brain.m_CameraCutEvent.AddListener(CutHandler);
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
m_Brain.m_CameraCutEvent.RemoveListener(CutHandler);
|
|
}
|
|
|
|
void CutHandler(CinemachineBrain brain)
|
|
{
|
|
var cam = brain.OutputCamera;
|
|
if (cam != null)
|
|
{
|
|
HDCamera hdCam = HDCamera.GetOrCreate(cam);
|
|
hdCam.Reset();
|
|
hdCam.volumetricHistoryIsValid = false;
|
|
hdCam.colorPyramidHistoryIsValid = false;
|
|
#if UNITY_EDITOR
|
|
Debug.Log("ResetVolumetricsOnCut.CutHandler");
|
|
#endif
|
|
}
|
|
}
|
|
}
|