Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

セットアップが完了していないBakedDataをTimelineに置いたときに発生するエラーを修正 #48

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

mkc1370
Copy link
Contributor

@mkc1370 mkc1370 commented Jul 18, 2023

概要

セットアップが完了していないBakedDataをTimelineに置いたときにTexture2D.whiteTextureをDestroyしようとしてエラーが発生していました。
セットアップが完了していない場合はTexture2D.whiteTextureではなく、new Texture2D(width, height)を返すようにしました。

補足

Object.Instantiate(Texture2D.whiteTexture)を使った方法

この方法で作成されるテクスチャは4x4のサイズなため、uLipSyncClipTimelineEditor.GetOrCreateCachedTexture()でキャッシュされたテクスチャと描画したいテクスチャのサイズが常に異なり、毎回テクスチャを再生成するようになってしまうため採用しませんでした。

懸念点

Textrue2Dをnewした場合はRGBAが全て205のテクスチャが作成されますが、恐らくこの仕様はドキュメントに記載されていないため明示的に白で埋めたほうがきれいかもしれません。
(今回は、あまり本質的でない処理内容が多くなってしまうため実装はしませんでした)

発生するエラー

Destroying object "UnityWhite" is not allowed at this time.
0x00007ff6922ba53d (Unity) StackWalker::GetCurrentCallstack
エラー全文

Destroying object "UnityWhite" is not allowed at this time.
0x00007ff6922ba53d (Unity) StackWalker::GetCurrentCallstack
0x00007ff6922c1299 (Unity) StackWalker::ShowCallstack
0x00007ff693225de3 (Unity) GetStacktrace
0x00007ff6938af47d (Unity) DebugStringToFile
0x00007ff691e876e1 (Unity) CheckAllowDestruction
0x00007ff6921d7651 (Unity) Scripting::DestroyObjectFromScriptingImmediate
0x00007ff69142bce3 (Unity) Object_CUSTOM_DestroyImmediate
0x000001d9f37d6acc (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Object:DestroyImmediate (UnityEngine.Object,bool)
0x000001d9f37d696b (Mono JIT Code) UnityEngine.Object:DestroyImmediate (UnityEngine.Object)
0x000001db2e635493 (Mono JIT Code) [uLipSyncClipEditor.cs:80] uLipSync.Timeline.uLipSyncClipTimelineEditor:RemoveCachedTexture (uLipSync.Timeline.uLipSyncClip)
0x000001db2e634fbb (Mono JIT Code) [uLipSyncClipEditor.cs:86] uLipSync.Timeline.uLipSyncClipTimelineEditor:CreateCachedTexture (uLipSync.Timeline.uLipSyncClip,int,int)
0x000001db2e634df3 (Mono JIT Code) [uLipSyncClipEditor.cs:116] uLipSync.Timeline.uLipSyncClipTimelineEditor:GetOrCreateCachedTexture (uLipSync.Timeline.uLipSyncClip,int,int)
0x000001db2e6347db (Mono JIT Code) [uLipSyncClipEditor.cs:153] uLipSync.Timeline.uLipSyncClipTimelineEditor:DrawWave (UnityEngine.Timeline.TimelineClip,UnityEditor.Timeline.ClipBackgroundRegion)
0x000001db2e631783 (Mono JIT Code) [uLipSyncClipEditor.cs:125] uLipSync.Timeline.uLipSyncClipTimelineEditor:DrawBackground (UnityEngine.Timeline.TimelineClip,UnityEditor.Timeline.ClipBackgroundRegion)
0x000001db2e616952 (Mono JIT Code) [ClipDrawer.cs:619] UnityEditor.Timeline.ClipDrawer:DrawClipEditorBackground (UnityEditor.Timeline.ClipDrawData)
0x000001db2e610b9b (Mono JIT Code) [ClipDrawer.cs:564] UnityEditor.Timeline.ClipDrawer:DrawDefaultClip (UnityEditor.Timeline.ClipDrawData)
0x000001db0c60f0fb (Mono JIT Code) [TimelineClipGUI.cs:322] UnityEditor.Timeline.TimelineClipGUI:DrawClip (UnityEditor.Timeline.ClipDrawData)
0x000001da4bcadceb (Mono JIT Code) [TimelineClipGUI.cs:379] UnityEditor.Timeline.TimelineClipGUI:DrawInto (UnityEngine.Rect,UnityEditor.Timeline.WindowState)
0x000001da4bca2b63 (Mono JIT Code) [TimelineClipGUI.cs:459] UnityEditor.Timeline.TimelineClipGUI:Draw (UnityEngine.Rect,bool,UnityEditor.Timeline.WindowState)
0x000001da4bca0e1d (Mono JIT Code) [ItemsLayer.cs:96] UnityEditor.Timeline.ItemsLayer1<T_REF>:Draw (UnityEngine.Rect,UnityEditor.Timeline.WindowState) 0x000001da4bca04bb (Mono JIT Code) [ClipsLayer.cs:39] UnityEditor.Timeline.ClipsLayer:Draw (UnityEngine.Rect,UnityEditor.Timeline.WindowState) 0x000001da4bca0229 (Mono JIT Code) [TrackItemsDrawer.cs:34] UnityEditor.Timeline.TrackItemsDrawer:Draw (UnityEngine.Rect,UnityEditor.Timeline.WindowState) 0x000001da4bc9828b (Mono JIT Code) [TimelineTrackGUI.cs:297] UnityEditor.Timeline.TimelineTrackGUI:Draw (UnityEngine.Rect,UnityEngine.Rect,UnityEditor.Timeline.WindowState) 0x000001da4bc8ebca (Mono JIT Code) [TimelineTreeView.cs:192] UnityEditor.Timeline.TimelineTreeView:OnRowGUI (UnityEngine.Rect,UnityEditor.IMGUI.Controls.TreeViewItem,int,bool,bool) 0x000001da4bc8d090 (Mono JIT Code) UnityEditor.IMGUI.Controls.TreeViewController:DoItemGUI (UnityEditor.IMGUI.Controls.TreeViewItem,int,single,bool) 0x000001da4bc8c2eb (Mono JIT Code) UnityEditor.IMGUI.Controls.TreeViewController:IterateVisibleItems (int,int,single,bool) 0x000001da4bc76443 (Mono JIT Code) UnityEditor.IMGUI.Controls.TreeViewController:OnGUI (UnityEngine.Rect,int) 0x000001da4bc720fb (Mono JIT Code) [TimelineTreeViewGUI.cs:152] UnityEditor.Timeline.TimelineTreeViewGUI:OnGUI (UnityEngine.Rect) 0x000001da4bc7174b (Mono JIT Code) [TimelineWindow_TrackGui.cs:133] UnityEditor.Timeline.TimelineWindow:DrawTracksGUI (UnityEngine.Rect,UnityEditor.Timeline.TimelineModeGUIState) 0x000001da4bc6f24b (Mono JIT Code) [TimelineWindow_TrackGui.cs:47] UnityEditor.Timeline.TimelineWindow:TracksGUI (UnityEngine.Rect,UnityEditor.Timeline.WindowState,UnityEditor.Timeline.TimelineModeGUIState) 0x000001da4bc6dd13 (Mono JIT Code) [TimelineWindow_Gui.cs:200] UnityEditor.Timeline.TimelineWindow:TrackViewsGUI () 0x000001da4bc14693 (Mono JIT Code) [TimelineWindow_Gui.cs:296] UnityEditor.Timeline.TimelineWindow:SequencerGUI () 0x000001da4bc13f53 (Mono JIT Code) [TimelineWindow_Gui.cs:165] UnityEditor.Timeline.TimelineWindow:DoLayout () 0x000001da4bb9a643 (Mono JIT Code) [TimelineWindow.cs:226] UnityEditor.Timeline.TimelineWindow:OnGUI () 0x000001da4bb94e59 (Mono JIT Code) UnityEditor.HostView:InvokeOnGUI (UnityEngine.Rect) 0x000001da4bb94993 (Mono JIT Code) UnityEditor.DockArea:DrawView (UnityEngine.Rect) 0x000001da44623eb3 (Mono JIT Code) UnityEditor.DockArea:OldOnGUI () 0x000001da44421ae1 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect,System.Action,bool) 0x000001da4422adf3 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,System.Action,bool) 0x000001dafddfd47b (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoIMGUIRepaint () 0x000001dafddf807a (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams,single,System.Exception&) 0x000001dafddf4d2b (Mono JIT Code) UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain (UnityEngine.UIElements.UIR.RenderChainCommand,UnityEngine.Material,UnityEngine.Material,UnityEngine.Texture,UnityEngine.Texture,single,Unity.Collections.NativeSlice1<UnityEngine.UIElements.UIR.Transform3x4>,Unity.Collections.NativeSlice`1<UnityEngine.Vector4>,UnityEngine.MaterialPropertyBlock,bool,System.Exception&)
0x000001dafdde81fb (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChain:Render ()
0x000001dafdda07c3 (Mono JIT Code) UnityEngine.UIElements.UIRRepaintUpdater:Update ()
0x000001da4412bcfa (Mono JIT Code) UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase)
0x000001dafdd9dc93 (Mono JIT Code) UnityEngine.UIElements.Panel:UpdateForRepaint ()
0x000001dafdd99df3 (Mono JIT Code) UnityEngine.UIElements.Panel:Repaint (UnityEngine.Event)
0x000001da4412a941 (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
0x000001da4412a293 (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&)
0x000001da44129c84 (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration:ProcessEvent (int,intptr)
0x000001da4412999b (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration/<>c:<.cctor>b__1_2 (int,intptr)
0x000001da44129445 (Mono JIT Code) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
0x000001da44129686 (Mono JIT Code) (wrapper runtime-invoke) :runtime_invoke_void_int_intptr_intptr& (object,intptr,intptr,intptr)
0x00007ffb4560e0a4 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono_jit_runtime_invoke
0x00007ffb4554e744 (mono-2.0-bdwgc) [object.c:3066] do_runtime_invoke
0x00007ffb4554e8dc (mono-2.0-bdwgc) [object.c:3113] mono_runtime_invoke
0x00007ff6921decf4 (Unity) scripting_method_invoke
0x00007ff6921d9914 (Unity) ScriptingInvocation::Invoke
0x00007ff6921d3235 (Unity) ScriptingInvocation::Invoke
0x00007ff6922dbe2a (Unity) Scripting::UnityEngine::GUIUtilityProxy::ProcessEvent
0x00007ff692d12396 (Unity) GUIView::ProcessRetainedMode
0x00007ff6932562ab (Unity) GUIView::OnInputEvent
0x00007ff692d121aa (Unity) GUIView::ProcessInputEvent
0x00007ff69324f04e (Unity) GUIView::DoPaint
0x00007ff69325843d (Unity) GUIView::RepaintAll
0x00007ff692de5d76 (Unity) PlayerLoopController::UpdateScene
0x00007ff692de3d5f (Unity) Application::TickTimer
0x00007ff69322bf7a (Unity) MainMessageLoop
0x00007ff69323084b (Unity) WinMain
0x00007ff694551d4e (Unity) __scrt_common_main_seh
0x00007ffc0bf626ad (KERNEL32) BaseThreadInitThunk
0x00007ffc0dbcaa68 (ntdll) RtlUserThreadStart

再現方法

  1. Baked Dataを作成
    image
  2. Baked DataをuLipSyncTrackに追加
    image
  3. Baked DataのProfileとAudio Clipに任意のアセットを設定
    image
  4. コンソールにエラーが表示される
    image

@hecomi
Copy link
Owner

hecomi commented Jul 18, 2023

詳細な説明および修正ありがとうございます!とても助かります。

@hecomi hecomi merged commit 3c3518b into hecomi:main Jul 18, 2023
@mkc1370 mkc1370 deleted the feature/fix_white_texture branch July 18, 2023 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants