Search Issue Tracker

By Design

Votes

0

Found in

2017.4

2018.4

2019.3

2019.3.1f1

2020.1

2020.2

Issue ID

1231726

Regression

No

Crash on ShaderPropertySheet::UpdateTextureInfo when RenderStaticPreview is called

Graphics - General

-

Reproduction steps:
1. Download QA attached project "case_1231726"
2. Delete library
3. Open project
4. Crash with
========== OUTPUTTING STACK TRACE ==================
0x00007FF6C264B189 (Unity) ShaderPropertySheet::UpdateTextureInfo
0x00007FF6C26488BE (Unity) ShaderPropertySheet::SetTexture
0x00007FF6C1FA005C (Unity) RenderSettings::UpdateGlobalState
0x00007FF6C1F883E1 (Unity) RenderSettings::AwakeFromLoad
0x00007FF6C361DD61 (Unity) ColorSpaceLiveSwitch
0x00007FF6C4DD2978 (Unity) PlayerSettings::SyncCurrentColorSpace
0x00007FF6C3790F91 (Unity) Application::InitializeProject
0x00007FF6C3F87F7B (Unity) WinMain
0x00007FF6C5BA97E6 (Unity) __scrt_common_main_seh
0x00007FF946987BD4 (KERNEL32) BaseThreadInitThunk
0x00007FF946E4CE51 (ntdll) RtlUserThreadStart
========== END OF STACKTRACE ===========

5. Reopen project without deleting library
6. Reimport "Text (TMP)" prefab
7. Crash with
========== OUTPUTTING STACK TRACE ==================
0x00007FF8BE6673C5 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\boehm-gc.c:2130] mono_gchandle_get_target
0x00007FF6C2BA4B54 (Unity) ScriptingGCHandle::ResolveBackendNativeGCHandle
0x00007FF6C2BBDCDC (Unity) Scripting::ScriptingWrapperFor
0x00007FF6C458BFE0 (Unity) EditorGUIUtility_Get_Custom_PropWhiteTexture
0x000001D6452A7D51 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorGUIUtility:get_whiteTexture ()
0x000001D6452A4FFB (Mono JIT Code) UnityEditor.StyleSheets.StylePainter:DrawBlock (UnityEngine.GUIStyle,UnityEditor.StyleSheets.StyleBlock,UnityEngine.Rect,UnityEngine.GUIContent,UnityEngine.DrawStates)
0x000001D6452A115B (Mono JIT Code) UnityEditor.StyleSheets.StylePainter:DrawStyle (UnityEngine.GUIStyle,UnityEngine.Rect,UnityEngine.GUIContent,UnityEngine.DrawStates)
0x000001D6452A19A4 (Mono JIT Code) (wrapper delegate-invoke) <Module>:invoke_bool_GUIStyle_Rect_GUIContent_DrawStates (UnityEngine.GUIStyle,UnityEngine.Rect,UnityEngine.GUIContent,UnityEngine.DrawStates)
0x000001D6452A0A91 (Mono JIT Code) UnityEngine.GUIStyle:Draw (UnityEngine.Rect,UnityEngine.GUIContent,int,bool,bool,bool,bool)
0x000001D6452A07F3 (Mono JIT Code) UnityEngine.GUIStyle:Draw (UnityEngine.Rect,UnityEngine.GUIContent,int)
0x000001D645285043 (Mono JIT Code) UnityEditor.DockArea:DrawDockAreaBackground (UnityEngine.Rect)
0x000001D645282F03 (Mono JIT Code) UnityEditor.DockArea:OldOnGUI ()
0x000001D64526DEF8 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect,System.Action,bool)
0x000001D64526D10B (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,System.Action,bool)
0x000001D64526B733 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoIMGUIRepaint ()
0x000001D64526A19B (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams,single,System.Exception&)
0x000001D645268883 (Mono JIT Code) UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain (UnityEngine.UIElements.UIR.RenderChainCommand,UnityEngine.Material,UnityEngine.Material,UnityEngine.Texture,UnityEngine.Texture,UnityEngine.Texture,single,Unity.Collections.NativeSlice`1<UnityEngine.UIElements.UIR.Transform3x4>,Unity.Collections.NativeSlice`1<UnityEngine.Vector4>,UnityEngine.MaterialPropertyBlock,bool,System.Exception&)
0x000001D645265853 (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChain:Render ()
0x000001D645245C53 (Mono JIT Code) UnityEngine.UIElements.UIRRepaintUpdater:Update ()
0x000001D6CBD097FE (Mono JIT Code) UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase)
0x000001D6CBD0970B (Mono JIT Code) UnityEngine.UIElements.Panel:UpdateForRepaint ()
0x000001D6CBD0923B (Mono JIT Code) UnityEngine.UIElements.Panel:Repaint (UnityEngine.Event)
0x000001D6CBD08B57 (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
0x000001D6CBD0886B (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&)
0x000001D6CBD0862F (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration:ProcessEvent (int,intptr)
0x000001D6CBD0854B (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration/<>c:<.cctor>b__1_2 (int,intptr)
0x000001D6CBD083CD (Mono JIT Code) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
0x000001D6CBD0847E (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_int_intptr_intptr& (object,intptr,intptr,intptr)
0x00007FF8BE67CDA0 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
0x00007FF8BE602112 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2921] do_runtime_invoke
0x00007FF8BE60B10F (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2968] mono_runtime_invoke
0x00007FF6C2BC2A04 (Unity) scripting_method_invoke
0x00007FF6C2BBC54B (Unity) ScriptingInvocation::Invoke
0x00007FF6C2BB6235 (Unity) ScriptingInvocation::Invoke<void>
0x00007FF6C14C47CD (Unity) Scripting::UnityEngine::GUIUtilityProxy::ProcessEvent
0x00007FF6C36D7918 (Unity) GUIView::ProcessRetainedMode
0x00007FF6C3F7FACB (Unity) GUIView::OnInputEvent
0x00007FF6C36D783B (Unity) GUIView::ProcessInputEventInternal
0x00007FF6C3F769E8 (Unity) GUIView::DoPaint
0x00007FF6C3F8218D (Unity) GUIView::RepaintAll
0x00007FF6C379EA1A (Unity) Application::TickTimer
0x00007FF6C3F7EDEC (Unity) MainMessageLoop
0x00007FF6C3F882FE (Unity) WinMain
0x00007FF6C5BA97E6 (Unity) __scrt_common_main_seh
0x00007FF946987BD4 (KERNEL32) BaseThreadInitThunk
0x00007FF946E4CE51 (ntdll) RtlUserThreadStart
========== END OF STACKTRACE ===========

8. Reopen project without deleting library
9. Edit CapsuleMeshAuthoringEditor.cs and
comment this line "return Texture2D.whiteTexture;"
uncomment this line "return base.RenderStaticPreview(assetPath, subAssets, width, height);"
10. save changes and reimport "Text (TMP)" prefab again
11. There is no crash

Reproducible with: 2017.4.40f1, 2018.4.21f1, 2019.3.11f1, 2020.1.0b6, 2020.2.0a7

  1. Resolution Note:

    RenderStaticPreview should always create a texture, and not use an internal builtin texture, like when writing "return Texture2D.whiteTexture;" (if so, the texture will be free later and you get a crash if we try to free the engine "whiteTexture"). This should be used instead:
    "return Object.Instantiate(Texture2D.whiteTexture);"

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.