public void SubScene_WithDependencyOnAssetInScene_ClearCache_EndToEnd()
        {
            var subScene = SubSceneTestsHelper.CreateSubSceneFromObjects(ref m_TempAssets, "SubScene", false, () =>
            {
                var go           = new GameObject();
                var authoring    = go.AddComponent <DependencyTestAuthoring>();
                var sphereHolder = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                authoring.Asset  = sphereHolder.GetComponent <MeshFilter>().sharedMesh;
                UnityEngine.Object.DestroyImmediate(sphereHolder);
                return(new List <GameObject> {
                    go
                });
            });

            var buildSettings = default(Unity.Entities.Hash128);
            var originalHash  = EntityScenesPaths.GetSubSceneArtifactHash(subScene.SceneGUID, buildSettings, ImportMode.Synchronous);

            Assert.IsTrue(originalHash.IsValid);

            // Clear Cache (First time this creates global dependency asset, so we will test both steps)
            EntitiesCacheUtility.UpdateEntitySceneGlobalDependency();

            var newHashCreated = EntityScenesPaths.GetSubSceneArtifactHash(subScene.SceneGUID, buildSettings, ImportMode.Synchronous);

            Assert.IsTrue(newHashCreated.IsValid);
            Assert.AreNotEqual(originalHash, newHashCreated);

            // Clear Cache (This updates existing asset)
            EntitiesCacheUtility.UpdateEntitySceneGlobalDependency();

            var newHashUpdated = EntityScenesPaths.GetSubSceneArtifactHash(subScene.SceneGUID, buildSettings, ImportMode.Synchronous);

            Assert.IsTrue(newHashUpdated.IsValid);
            Assert.AreNotEqual(newHashCreated, newHashUpdated);
            Assert.AreNotEqual(originalHash, newHashUpdated);

            // Delete created dependency, this cleans up test but also we need to verify that the scene returns to the original hash
            AssetDatabase.DeleteAsset(EntitiesCacheUtility.globalEntitiesDependencyDir);
            AssetDatabase.Refresh();

            // With the dependency deleted, the hash should return to the original
            var finalHash = EntityScenesPaths.GetSubSceneArtifactHash(subScene.SceneGUID, buildSettings, ImportMode.Synchronous);

            Assert.AreEqual(originalHash, finalHash);
        }
            public void Initialize(EditorWindow editorWindow, VisualElement rootVisualElement)
            {
                VisualTreeAsset uiAsset = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Packages/com.unity.entities/Unity.Scenes.Editor/ClearEntitiesCacheWindow/ClearEntitiesCacheWindow.uxml");

                rootVisualElement.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>("Packages/com.unity.entities/Unity.Scenes.Editor/ClearEntitiesCacheWindow/ClearEntitiesCacheWindow.uss"));

                m_Root = uiAsset.CloneTree();
                m_Root.style.flexGrow = 1;

                m_CancelButton          = m_Root.Query <Button>("cancel-button");
                m_CancelButton.clicked += () =>
                {
                    editorWindow.Close();
                };

                m_ClearButton          = m_Root.Query <Button>("clear-cache-button");
                m_ClearButton.clicked += () =>
                {
                    if (m_EntitySceneCacheToggle.value)
                    {
                        EntitiesCacheUtility.UpdateEntitySceneGlobalDependency();
                    }

                    if (m_LiveLinkAssetCacheToggle.value)
                    {
                        EntitiesCacheUtility.UpdateLiveLinkAssetGlobalDependency();
                    }

                    if (m_LiveLinkPlayerCacheToggle.value)
                    {
                        LiveLinkUtility.GenerateNewEditorLiveLinkCacheGUID();
                    }

                    editorWindow.Close();
                };

                m_EntitySceneCacheToggle    = m_Root.Query <Toggle>("clear-entityscene-toggle");
                m_LiveLinkAssetCacheToggle  = m_Root.Query <Toggle>("clear-livelinkassets-toggle");
                m_LiveLinkPlayerCacheToggle = m_Root.Query <Toggle>("clear-livelinkplayer-toggle");


                rootVisualElement.Add(m_Root);
            }