Skip to content

Commit 615cbd2

Browse files
julienamsellemEvergreen
authored andcommitted
[VFX] Close VFX template window on domain reload
Jira: UUM-62433 Steps to reproduce: - Start new project, import VFX graph - Right click -> create new VFX graph to open Template window - Without closing in, cause a domain reload (hit play, switch editor theme) => Observe window becomes empty 💡Proposed solution: closing window would be the best option here
1 parent d744b58 commit 615cbd2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Packages/com.unity.visualeffectgraph/Editor/TemplateWindow/VFXTemplateWindow.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,21 @@ private void LoadTemplates()
156156
m_ListOfTemplates.ExpandAll();
157157
}
158158

159+
private void OnEnable()
160+
{
161+
AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload;
162+
}
163+
164+
private void OnDisable()
165+
{
166+
AssemblyReloadEvents.beforeAssemblyReload -= OnBeforeAssemblyReload;
167+
}
168+
169+
private void OnBeforeAssemblyReload()
170+
{
171+
this.Close();
172+
}
173+
159174
private void OnDestroy()
160175
{
161176
EditorPrefs.SetString(LastSelectedGuidKey, m_LastSelectedTemplateGuid);

0 commit comments

Comments
 (0)