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