Exemple #1
0
        private static void ImportVci(UnityPath path)
        {
            if (!path.IsUnderAssetsFolder)
            {
                throw new Exception();
            }
            var importer = new VCIImporter();

            importer.ParseGlb(File.ReadAllBytes(path.FullPath));

            var prefabPath = path.Parent.Child(path.FileNameWithoutExtension + ".prefab");

            // save texture assets !
            importer.ExtractImages(prefabPath);
            importer.ExtractAudio(prefabPath);
            importer.ExtractEffekseer(prefabPath);
            importer.ExtractAnimation(prefabPath);

            EditorApplication.delayCall += () =>
            {
                //
                // after textures imported
                //
                importer.Load();
                importer.SetupCoroutine().CoroutineToEnd();
                importer.SetupPhysics();
                importer.SetupAttachable();
                importer.SetupEffekseer().CoroutineToEnd();
                importer.SetupText();
                importer.SetupSpringBone();
                importer.SetupPlayerSpawnPoint();
                importer.SetupLocationBounds();
                importer.SaveAsAsset(prefabPath);
                importer.EditorDestroyRoot();
            };
        }