错误解决 error CS0117: ‘Buffer‘ does not contain a definition for ‘BlockCopy‘
错误解决 error CS0117: ‘Buffer‘ does not contain a definition for ‘BlockCopy‘
·
Unity 2022.3.9f1 导入 Runtime OBJ Importer 后出现:
error CS0117: ‘Buffer’ does not contain a definition for ‘BlockCopy’
解决办法:
源代码:
int DDS_HEADER_SIZE = 128;
byte[] dxtBytes = new byte[ddsBytes.Length - DDS_HEADER_SIZE];
Buffer.BlockCopy(ddsBytes, DDS_HEADER_SIZE, dxtBytes, 0, ddsBytes.Length - DDS_HEADER_SIZE);
改成:
int DDS_HEADER_SIZE = 128;
byte[] dxtBytes = new byte[ddsBytes.Length - DDS_HEADER_SIZE];
Array.Copy(ddsBytes, DDS_HEADER_SIZE, dxtBytes, 0, ddsBytes.Length - DDS_HEADER_SIZE);
几乎所有类似的问题,都可以把Buffer.BlockCopy()
改为Array.Copy()
来解决。
更多推荐
已为社区贡献1条内容
所有评论(0)