File tree Expand file tree Collapse file tree
Packages/com.unity.render-pipelines.universal/Runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -435,5 +435,19 @@ void ISerializationCallbackReceiver.OnAfterDeserialize()
435435 version = Version . RenderingLayerMask ;
436436 }
437437 }
438+
439+ #if UNITY_EDITOR
440+ [ RuntimeInitializeOnLoadMethod ( RuntimeInitializeLoadType . SubsystemRegistration ) ]
441+ static void ResetStaticsOnLoad ( )
442+ {
443+ onDecalAdd = null ;
444+ onDecalRemove = null ;
445+ onDecalPropertyChange = null ;
446+ onAllDecalPropertyChange = null ;
447+ onDecalMaterialChange = null ;
448+
449+ defaultMaterial = null ;
450+ }
451+ #endif
438452 }
439453}
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ public void Release(DecalEntityManager decalEntityManager)
128128
129129 public void Dispose ( )
130130 {
131- m_DecalEntityManager . Dispose ( ) ;
131+ m_DecalEntityManager ? . Dispose ( ) ;
132132 m_DecalEntityManager = null ;
133133 m_ReferenceCounter = 0 ;
134134
@@ -182,7 +182,7 @@ private void OnDecalMaterialChange(DecalProjector decalProjector)
182182 [ Icon ( "Packages/com.unity.render-pipelines.core/Editor/Icons/Processed/DecalProjector Icon.asset" ) ]
183183 public partial class DecalRendererFeature : ScriptableRendererFeature
184184 {
185- private static SharedDecalEntityManager sharedDecalEntityManager { get ; } = new SharedDecalEntityManager ( ) ;
185+ private static SharedDecalEntityManager sharedDecalEntityManager = new SharedDecalEntityManager ( ) ;
186186
187187 [ SerializeField ]
188188 private DecalSettings m_Settings = new DecalSettings ( ) ;
@@ -557,5 +557,14 @@ private void ChangeAdaptivePerformanceDrawDistances()
557557 }
558558#endif
559559 }
560+
561+ #if UNITY_EDITOR
562+ [ RuntimeInitializeOnLoadMethod ( RuntimeInitializeLoadType . SubsystemRegistration ) ]
563+ static void ResetStaticsOnLoad ( )
564+ {
565+ sharedDecalEntityManager ? . Dispose ( ) ;
566+ sharedDecalEntityManager = new SharedDecalEntityManager ( ) ;
567+ }
568+ #endif
560569 }
561570}
You can’t perform that action at this time.
0 commit comments