@@ -551,6 +551,10 @@ void OnDestroy()
551
551
CoreUtils . Destroy ( volume ) ;
552
552
}
553
553
}
554
+
555
+ // We don't need the custom passes anymore
556
+ var hdPipeline = RenderPipelineManager . currentPipeline as HDRenderPipeline ;
557
+ UnRegisterCustomPasses ( hdPipeline ) ;
554
558
}
555
559
556
560
public void AddInputFilterAtLayer ( CompositionFilter filter , int index )
@@ -929,14 +933,12 @@ static internal void RegisterCustomPasses(HDRenderPipeline hdPipeline)
929
933
}
930
934
931
935
// If custom post processes are not registered in the HDRP asset, they are never executed so we have to add them manually
932
- int indx = hdPipeline . asset . beforePostProcessCustomPostProcesses . FindIndex ( x => x == typeof ( ChromaKeying ) . AssemblyQualifiedName ) ;
933
- if ( indx < 0 )
936
+ if ( ! hdPipeline . asset . beforePostProcessCustomPostProcesses . Contains ( typeof ( ChromaKeying ) . AssemblyQualifiedName ) )
934
937
{
935
938
hdPipeline . asset . beforePostProcessCustomPostProcesses . Add ( typeof ( ChromaKeying ) . AssemblyQualifiedName ) ;
936
939
}
937
940
938
- indx = hdPipeline . asset . beforePostProcessCustomPostProcesses . FindIndex ( x => x == typeof ( AlphaInjection ) . AssemblyQualifiedName ) ;
939
- if ( indx < 0 )
941
+ if ( ! hdPipeline . asset . beforePostProcessCustomPostProcesses . Contains ( typeof ( AlphaInjection ) . AssemblyQualifiedName ) )
940
942
{
941
943
hdPipeline . asset . beforePostProcessCustomPostProcesses . Add ( typeof ( AlphaInjection ) . AssemblyQualifiedName ) ;
942
944
}
@@ -950,14 +952,12 @@ static internal void UnRegisterCustomPasses(HDRenderPipeline hdPipeline)
950
952
return ;
951
953
}
952
954
953
- int indx = hdPipeline . asset . beforePostProcessCustomPostProcesses . FindIndex ( x => x == typeof ( ChromaKeying ) . AssemblyQualifiedName ) ;
954
- if ( indx >= 0 )
955
+ if ( hdPipeline . asset . beforePostProcessCustomPostProcesses . Contains ( typeof ( ChromaKeying ) . AssemblyQualifiedName ) )
955
956
{
956
957
hdPipeline . asset . beforePostProcessCustomPostProcesses . Remove ( typeof ( ChromaKeying ) . AssemblyQualifiedName ) ;
957
958
}
958
959
959
- indx = hdPipeline . asset . beforePostProcessCustomPostProcesses . FindIndex ( x => x == typeof ( AlphaInjection ) . AssemblyQualifiedName ) ;
960
- if ( indx >= 0 )
960
+ if ( hdPipeline . asset . beforePostProcessCustomPostProcesses . Contains ( typeof ( AlphaInjection ) . AssemblyQualifiedName ) )
961
961
{
962
962
hdPipeline . asset . beforePostProcessCustomPostProcesses . Remove ( typeof ( AlphaInjection ) . AssemblyQualifiedName ) ;
963
963
}
0 commit comments