Ejemplo n.º 1
0
        public static ModelInfo CreateModelInfo(string assetPath)
        {
            ModelInfo tInfo = null;

            if (!m_dictTexInfo.TryGetValue(assetPath, out tInfo))
            {
                tInfo = new ModelInfo();
                m_dictTexInfo.Add(assetPath, tInfo);
            }
            ModelImporter tImport = AssetImporter.GetAtPath(assetPath) as ModelImporter;

            if (tImport == null)
            {
                return(null);
            }

            tInfo.Path            = assetPath;
            tInfo.ReadWriteEnable = tImport.isReadable;
            tInfo.OptimizeMesh    = tImport.optimizeMesh;
            tInfo.ImportMaterials = tImport.importMaterials;
            tInfo.ImportAnimation = tImport.importAnimation;
            tInfo.MeshCompression = tImport.meshCompression;

            tInfo.MemSize = EditorCommon.CalculateModelSizeBytes(assetPath);

            if (m_loadCount % 256 == 0)
            {
                Resources.UnloadUnusedAssets();
            }

            return(tInfo);
        }