public void ChangeSceneCacheOnDirectPrefab()
        {
            //Initial setup
            const string DEST_PREFAB_PATH = "Assets/TestSceneCache.prefab";
            const string ASSETS_FOLDER    = "Assets/TestSceneCacheAssets";

            bool prefabCreated = SceneCachePlayerEditorUtility.CreateSceneCachePlayerAndPrefab(
                Path.GetFullPath(MeshSyncTestEditorConstants.CUBE_TEST_DATA_PATH), DEST_PREFAB_PATH, ASSETS_FOLDER,
                out SceneCachePlayer player, out GameObject prefab
                );

            Assert.IsTrue(prefabCreated);

            //Check the prefab
            Assert.IsFalse(prefab.IsPrefabInstance());
            Assert.IsTrue(prefab.IsPrefab());
            SceneCachePlayer prefabPlayer = prefab.GetComponent <SceneCachePlayer>();

            Assert.IsNotNull(prefabPlayer);
            Camera cam0   = prefabPlayer.GetComponentInChildren <Camera>();
            Light  light0 = prefabPlayer.GetComponentInChildren <Light>();

            //Change
            TestDataComponents comps = ChangeSceneCacheFileAndVerify(prefabPlayer,
                                                                     Path.GetFullPath(MeshSyncTestEditorConstants.SPHERE_TEST_DATA_PATH)
                                                                     );

            Assert.AreEqual(cam0, comps.cam);
            Assert.AreEqual(light0, comps.light);

            //Cleanup
            Object.DestroyImmediate(player.gameObject);
            DeleteSceneCachePlayerPrefab(prefab);
        }
        public void ChangeSceneCacheOnInstancedPrefab()
        {
            //Initial setup
            const string DEST_PREFAB_PATH = "Assets/TestSceneCache.prefab";
            const string ASSETS_FOLDER    = "Assets/TestSceneCacheAssets";

            bool prefabCreated = SceneCachePlayerEditorUtility.CreateSceneCachePlayerAndPrefab(
                Path.GetFullPath(MeshSyncTestEditorConstants.CUBE_TEST_DATA_PATH), DEST_PREFAB_PATH, ASSETS_FOLDER,
                out SceneCachePlayer player, out GameObject prefab
                );

            Assert.IsTrue(prefabCreated);

            //Check the instanced prefab
            Assert.IsNotNull(player);
            Assert.IsTrue(player.gameObject.IsPrefabInstance());
            Camera       cam0   = player.GetComponentInChildren <Camera>();
            Light        light0 = player.GetComponentInChildren <Light>();
            MeshRenderer mr0    = player.GetComponentInChildren <MeshRenderer>();

            Assert.IsNotNull(cam0);
            Assert.IsNotNull(light0);
            Assert.IsNotNull(mr0);

            GameObject capsule = GameObject.CreatePrimitive(PrimitiveType.Capsule);

            capsule.transform.SetParent(light0.transform);

            GameObject cylinder = GameObject.CreatePrimitive(PrimitiveType.Cylinder);

            cylinder.transform.SetParent(mr0.transform);

            //Change
            TestDataComponents comps = ChangeSceneCacheFileAndVerify(player, Path.GetFullPath(MeshSyncTestEditorConstants.SPHERE_TEST_DATA_PATH));

            Assert.IsTrue(player.IsSceneCacheOpened());
            Assert.AreEqual(cam0, comps.cam);
            Assert.AreEqual(light0, comps.light);
            Assert.AreNotEqual(mr0, comps.meshRenderer);

            Assert.IsTrue(capsule != null);
            Assert.IsFalse(capsule.IsPrefabInstance());
            Assert.IsTrue(cylinder == null); //should have been deleted when changing sc


            //Cleanup
            Object.DestroyImmediate(player.gameObject);
            DeleteSceneCachePlayerPrefab(prefab);
        }
//----------------------------------------------------------------------------------------------------------------------

        static TestDataComponents ChangeSceneCacheFileAndVerify(SceneCachePlayer player, string scPath)
        {
            SceneCachePlayerEditorUtility.ChangeSceneCacheFile(player, scPath);
            string savedScFilePath = player.GetSceneCacheFilePath();

            Assert.AreEqual(AssetEditorUtility.NormalizePath(scPath), savedScFilePath);
            Assert.IsTrue(AssetEditorUtility.IsPathNormalized(savedScFilePath), $"{savedScFilePath} is not normalized");
            Assert.IsTrue(player.transform.childCount > 0);

            TestDataComponents ret = new TestDataComponents(
                player.GetComponentInChildren <Camera>(),
                player.GetComponentInChildren <Light>(),
                player.GetComponentInChildren <MeshRenderer>()
                );

            Assert.IsNotNull(ret.cam);
            Assert.IsNotNull(ret.light);
            Assert.IsNotNull(ret.meshRenderer);
            return(ret);
        }