コード例 #1
0
        static void OnPostprocessAllAssets(string[] importedAssets,
                                           string[] deletedAssets,
                                           string[] movedAssets,
                                           string[] movedFromAssetPaths)
        {
            foreach (string path in importedAssets)
            {
                if (UnityPath.FromUnityPath(path).IsStreamingAsset)
                {
                    Debug.LogFormat("Skip StreamingAssets: {0}", path);
                    continue;
                }

                var ext = Path.GetExtension(path).ToLower();
                switch (ext)
                {
                case ".gltf":
                case ".glb":
                {
                    var gltfPath   = UnityPath.FromUnityPath(path);
                    var prefabPath = gltfPath.Parent.Child(gltfPath.FileNameWithoutExtension + ".prefab");
                    ImportAsset(UnityPath.FromUnityPath(path).FullPath, ext, prefabPath);
                    break;
                }
                }
            }
        }
コード例 #2
0
ファイル: UniGLTFTests.cs プロジェクト: notargs/VCI
        public void UnityPathTest()
        {
            var root = UnityPath.FromUnityPath(".");

            Assert.IsFalse(root.IsNull);
            Assert.IsFalse(root.IsUnderAssetsFolder);
            Assert.AreEqual(UnityPath.FromUnityPath("."), root);

            var assets = UnityPath.FromUnityPath("Assets");

            Assert.IsFalse(assets.IsNull);
            Assert.IsTrue(assets.IsUnderAssetsFolder);

            var rootChild = root.Child("Assets");

            Assert.AreEqual(assets, rootChild);

            var assetsChild = assets.Child("Hoge");
            var hoge        = UnityPath.FromUnityPath("Assets/Hoge");

            Assert.AreEqual(assetsChild, hoge);

            //var children = root.TraverseDir().ToArray();
        }