This repository was archived by the owner on Nov 30, 2020. It is now read-only.
Commit 1ed5892
Fixed a nullref when adding a new effect in a larger scene.
Adding a new effect can cause an infrequent nullreference: https://streamable.com/bk03b. Only seems to happen with large scenes, and only the first effect you add. The whole stacktrace is:
```
NullReferenceException: (null)
UnityEditor.SerializedObject..ctor (UnityEngine.Object obj) (at C:/buildslave/unity/build/Editor/Mono/SerializedObject.cs:10)
UnityEditor.Rendering.PostProcessing.PostProcessEffectBaseEditor.Init (UnityEngine.Rendering.PostProcessing.PostProcessEffectSettings target, UnityEditor.Editor inspector) (at Assets/Plugins/packages/PostProcessing/Editor/PostProcessEffectBaseEditor.cs:32)
UnityEditor.Rendering.PostProcessing.EffectListEditor.CreateEditor (UnityEngine.Rendering.PostProcessing.PostProcessEffectSettings settings, UnityEditor.SerializedProperty property, Int32 index) (at Assets/Plugins/packages/PostProcessing/Editor/EffectListEditor.cs:86)
UnityEditor.Rendering.PostProcessing.EffectListEditor.AddEffectOverride (System.Type type) (at Assets/Plugins/packages/PostProcessing/Editor/EffectListEditor.cs:231)
UnityEditor.Rendering.PostProcessing.EffectListEditor+<OnGUI>c__AnonStorey1.<>m__0 () (at Assets/Plugins/packages/PostProcessing/Editor/EffectListEditor.cs:189)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, Int32 selected) (at C:/buildslave/unity/build/artifacts/generated/common/editor/GenericMenuBindings.gen.cs:121)
```
The AddEffectOverride method calls AssetDatabase.SaveAssets, which causes the effect to be nullified. Probably there is some reloading going on?
https://streamable.com/nlujr
Moved the SaveAssets to the end of the method, added a comment to explain what and why.1 parent a91372d commit 1ed5892
1 file changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
221 | 226 | | |
222 | 227 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| |||
0 commit comments