예제 #1
0
        public IEnumerator ReloadPlayableAsset()
        {
            PlayableDirector director = EditorUtilityTest.NewSceneWithDirector();
            TimelineClip     clip     = EditorUtilityTest.CreateTestSISTimelineClip(director);
            StreamingImageSequencePlayableAsset sisAsset = clip.asset as StreamingImageSequencePlayableAsset;

            Assert.IsNotNull(sisAsset);

            string folder = sisAsset.GetFolder();

            Assert.IsNotNull(folder);
            int numOriginalImages = sisAsset.GetNumImages();

            Assert.Greater(numOriginalImages, 0);


            List <WatchedFileInfo> testImages       = sisAsset.FindImages(folder);
            List <string>          copiedImagePaths = new List <string>(testImages.Count);

            foreach (WatchedFileInfo imageFile in testImages)
            {
                string fileName = imageFile.GetName();
                string src      = Path.Combine(folder, fileName);
                string dest     = Path.Combine(folder, "Copied_" + fileName);
                File.Copy(src, dest, true);
                copiedImagePaths.Add(dest);
            }

            yield return(null);

            sisAsset.Reload();

            yield return(null);

            Assert.AreEqual(numOriginalImages * 2, sisAsset.GetNumImages());

            //Cleanup
            foreach (string imagePath in copiedImagePaths)
            {
                File.Delete(imagePath);
            }


            EditorUtilityTest.DestroyTestTimelineAssets(clip);
            yield return(null);
        }