コード例 #1
0
        public void Import(Stream input, string path)
        {
            var prefabPath = Path.GetDirectoryName(path) + "/" + Path.GetFileNameWithoutExtension(path) + ".prefab";

            if (File.Exists(prefabPath))
            {
                return;
            }

            try
            {
                var reader = new Fmdl();
                reader.Read(input);

                Directory.CreateDirectory(Path.GetDirectoryName(Directory.GetParent(assetPath) + "/" + path));
                var createMeshCommand = new CreateMesh(() => reader.CreateAndSaveMesh(path));
                unityThreadDispacher.DispatchCommand(createMeshCommand);
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogError(e);
                throw;
            }
        }