加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 通过代码在Unity中使Texture2D可读

发布时间:2020-12-15 18:09:03 所属栏目:百科 来源:网络整理
导读:参见英文答案 How to make Texture2D Readable via script1个 我有一些AssetBundles,我想转换为.png图像文件. 它们是Texture2D资产,但问题是它们不是Read Enable,当时 我尝试将它们转换为PNG var _bytes = _texture2d.EncodeToPNG(); 命令,我收到以下错误信
参见英文答案 > How to make Texture2D Readable via script1个
我有一些AssetBundles,我想转换为.png图像文件.

它们是Texture2D资产,但问题是它们不是Read Enable,当时
我尝试将它们转换为PNG

var _bytes = _texture2d.EncodeToPNG();

命令,我收到以下错误信息:

Texture ‘name of a texture’ is not readable,the texture memory can not be accessed from scripts. You can make the texture readable in the
Texture Import Settings.

我真的无法访问纹理导入设置,因为它们来自资产包,一切都是用代码制作的.

有人有解决方法吗?

谢谢

解决方法

在项目中选择纹理,打开检查器窗口,将纹理类型设置为“高级”,切换“读取和写入启用”.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读