码迷,mamicode.com
首页 > 编程语言 > 详细

Unity使用Resources读取Resources路径下的二进制文件(Binary Data)必须使用 .bytes扩展名

时间:2016-07-08 17:52:13      阅读:1365      评论:0      收藏:0      [点我收藏+]

标签:

将某二进制文件放在Resources目录下,希望用Resources.Load<TextAsset>的方式读取,发现TextAsset是null

查阅Unity文档得知,使用Resources.Load读二进制文件,则文件扩展名必须为bytes

另外注意,Resources.Load的路径不要包含扩展名

Please notice that files with the .txt and .bytes extension will be treated as text and binary files, respectively. Do not attempt to store a binary file using the .txt extension, as this will create unexpected behaviour when attempting to read data from it.

https://docs.unity3d.com/Manual/class-TextAsset.html

Unity使用Resources读取Resources路径下的二进制文件(Binary Data)必须使用 .bytes扩展名

标签:

原文地址:http://www.cnblogs.com/xixidaguai/p/5654052.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!