diff --git a/jp.iridescent.cameraliveproduction/Script/CameraMixerTimeline/CameraMixerTimelineMixerBehaviour.cs b/jp.iridescent.cameraliveproduction/Script/CameraMixerTimeline/CameraMixerTimelineMixerBehaviour.cs index 623e6b2..5378f5d 100644 --- a/jp.iridescent.cameraliveproduction/Script/CameraMixerTimeline/CameraMixerTimelineMixerBehaviour.cs +++ b/jp.iridescent.cameraliveproduction/Script/CameraMixerTimeline/CameraMixerTimelineMixerBehaviour.cs @@ -39,6 +39,9 @@ public class CameraMixerTimelineMixerBehaviour : PlayableBehaviour internal PlayableDirector director; internal CameraMixerTimelineTrack track; private bool isFirstFrameHappened = false; + + private HashSet postProductionSet = new(); + // NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties. public override void ProcessFrame(Playable playable, FrameData info, object playerData) { @@ -78,7 +81,6 @@ public override void ProcessFrame(Playable playable, FrameData info, object play ScriptPlayable inputPlayable = (ScriptPlayable)playable.GetInput(i); CameraMixerTimelineBehaviour input = inputPlayable.GetBehaviour(); - input.cameraPostProductions.Distinct(); #if UNITY_EDITOR @@ -152,11 +154,14 @@ public override void OnPlayableDestroy (Playable playable) private void UpdatePostEffect( CameraMixerTimelineBehaviour input) { + postProductionSet.Clear(); + foreach (var postProduction in input.cameraPostProductions) { - if (postProduction.progress != 0f) + if (postProduction.progress != 0f && !postProductionSet.Contains(postProduction)) { postProduction.UpdateEffect(input.liveCamera, 0f, 0f); + postProductionSet.Add(postProduction); } } }