Skip to content

Commit b60390a

Browse files
committed
Fixed copy materials being recreated on every frame (#1182118)
1 parent a5fe3f1 commit b60390a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
### Fixed
1313
- Potential fp16 overflow in Depth of Field that could cause NaN on some platforms.
1414
- Error with Screen-space Reflections when HDR is disabled.
15+
- Internal "copy" materials were recreated on every frame after the asset bundle-related fix from 2.1.7.
1516

1617
## [2.1.7] - 2019-06-12
1718

PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ public enum Antialiasing
120120
[SerializeField]
121121
PostProcessResources m_Resources;
122122

123+
// Some juggling needed to track down reference to the resource asset when loaded from asset
124+
// bundle (guid conflict)
125+
PostProcessResources m_OldResources;
126+
123127
// UI states
124128
#if UNITY_2017_1_OR_NEWER
125129
[UnityEngine.Scripting.Preserve]
@@ -804,7 +808,13 @@ public bool HasActiveEffects(PostProcessEvent evt, PostProcessRenderContext cont
804808

805809
void SetupContext(PostProcessRenderContext context)
806810
{
807-
RuntimeUtilities.UpdateResources(m_Resources);
811+
// Juggling required when a scene with post processing is loaded from an asset bundle
812+
// See #1148230
813+
if (m_OldResources != m_Resources)
814+
{
815+
RuntimeUtilities.UpdateResources(m_Resources);
816+
m_OldResources = m_Resources;
817+
}
808818

809819
m_IsRenderingInSceneView = context.camera.cameraType == CameraType.SceneView;
810820
context.isSceneView = m_IsRenderingInSceneView;

0 commit comments

Comments
 (0)