unity 代碼更改圖片配置

/// <summary>
    /// texture格式設置
    /// </summary>
    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);
        }
       

    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章