unity 代码更改图片配置

/// 
    /// texture格式设置
    /// 
    void FormatTexture(Texture2D texture)
    {
        //拷贝配置文件时会自动更改配置
        return;
        if (texture == null)
            return;
        string path = AssetDatabase.GetAssetPath(texture);
        TextureImporter import = AssetImporter.GetAtPath(path) as TextureImporter;
        if (import == null)
            return;
        if (import.textureType == TextureImporterType.Lightmap)
        {
            //格式已做过修改,返回
            return;
        }
        else
        {
            //未修改,设置格式
            import.textureType = TextureImporterType.Lightmap;
            import.streamingMipmaps = true;
            AssetDatabase.ImportAsset(path);
        }
       

    }

 

你可能感兴趣的:(unity 代码更改图片配置)