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


将某二进制文件放在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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM