Skip to content

Commit dfe4d06

Browse files
committed
Fixed asset bundle reloading nullref
1 parent 997e0c1 commit dfe4d06

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99
### Fixed
1010
- Viewport handling wasn't working correctly when FXAA or SMAA were used with builtin pipelines.
1111
- Depth of Field could end up fully blurry depending on the project setup.
12+
- Reloading an asset bundle that has references to post-processing was broken.
1213

1314
### Changed
1415
- Warning for mobiles about using post-processing with non-fullscreen cameras.

PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ public bool HasActiveEffects(PostProcessEvent evt, PostProcessRenderContext cont
785785

786786
void SetupContext(PostProcessRenderContext context)
787787
{
788-
RuntimeUtilities.s_Resources = m_Resources;
788+
RuntimeUtilities.UpdateResources(m_Resources);
789789

790790
m_IsRenderingInSceneView = context.camera.cameraType == CameraType.SceneView;
791791
context.isSceneView = m_IsRenderingInSceneView;

PostProcessing/Runtime/Utils/RuntimeUtilities.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ public static Texture2D GetLutStrip(int size)
223223

224224
#region Rendering
225225

226-
internal static PostProcessResources s_Resources;
227-
226+
static PostProcessResources s_Resources;
228227
static Mesh s_FullscreenTriangle;
229228

230229
/// <summary>
@@ -382,6 +381,24 @@ public static PropertySheet copyFromTexArraySheet
382381
}
383382
}
384383

384+
internal static void UpdateResources(PostProcessResources resources)
385+
{
386+
Destroy(s_CopyMaterial);
387+
Destroy(s_CopyStdMaterial);
388+
Destroy(s_CopyFromTexArrayMaterial);
389+
Destroy(s_CopyStdFromDoubleWideMaterial);
390+
391+
s_CopyMaterial = null;
392+
s_CopyStdMaterial = null;
393+
s_CopyFromTexArrayMaterial = null;
394+
s_CopyStdFromDoubleWideMaterial = null;
395+
396+
s_CopySheet = null;
397+
s_CopyFromTexArraySheet = null;
398+
399+
s_Resources = resources;
400+
}
401+
385402
/// <summary>
386403
/// Sets the current render target using specified <see cref="RenderBufferLoadAction"/>.
387404
/// </summary>

0 commit comments

Comments
 (0)