Tencent / puerts

PUER(普洱) Typescript. Let's write your game in UE or Unity with TypeScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[UE] Bug: TArray<uint8> 通过 FArrayBuffer 传入 ts Uint8Array,内容不匹配

slb1988 opened this issue · comments

前置阅读 | Pre-reading

Puer的版本 | Puer Version

1.0.7

UE的版本 | UE Version

5.4.3

发生在哪个平台 | Platform

Editor(win)

错误信息 | Error Message

C++代码:
FArrayBuffer AdvanceListTypeBuffer;
TArray<uint8> Buffer = ReadFileToByteArray(TEXT("advancelisttype.bytes"));
// 第三个参数 true false结果都一样
AdvanceListTypeBuffer = FArrayBuffer { Buffer.GetData(), (size_t)Buffer.Num() };

通过 FArrayBuffer 封装成传入TS

TS代码:
let u8array = new Uint8Array(ueTableDataMgr.AdvanceListTypeBuffer);
console.log(u8array.length);
console.log(u8array);

length是对的上的,但内容随机,匹配不上

c++ 数据:
Snipaste_2024-08-23_15-54-49

ts 数据:
Puerts: (0x0000095A6AED89D0) 388
Puerts: (0x0000095A6AED89D0) 0,35,2,106,90,9,0,0,4,0,0,0,1,0,0,0,16,0,0,0,12,0,20,0,4,0,8,0,12,0,16,0,12,0,0,0,1,0,0,0,8,1,0,0,168,0,0,0,4,0,0,0,3,0,0,0,116,0,0,0,60,0,0,0,4,0,0,0,52,255,255,255,3,0,0,0,4,0,0,0,3,0,0,0,28,0,0,0,16,0,0,0,4,0,0,0,3,0,0,0,104,104,104,0,3,0,0,0,103,103,103,0,3,0,0,0,102,102,102,0,104,255,255,255,2,0,0,0,4,0,0,0,3,0,0,0,28,0,0,0,16,0,0,0,4,0,0,0,3,0,0,0,101,101,101,0,3,0,0,0,100,100,100,0,3,0,0,0,99,99,99,0,156,255,255,255,1,0,0,0,4,0,0,0,2,0,0,0,16,0,0,0,4,0,0,0,3,0,0,0,98,98,98,0,3,0,0,0,97,97,97,0,3,0,0,0,64,0,0,0,32,0,0,0,4,0,0,0,212,255,255,255,3,0,0,0,4,0,0,0
,4,0,0,0,120,99,118,122,0,0,0,0,236,255,255,255,2,0,0,0,4,0,0,0,3,0,0,0,106,107,108,0,8,0,12,0,4,0,8,0,8,0,0,0,1,0,0,0,4,0,0,0,4,0,0,0,97,115,100,102,0,0,0,0,3,0,0,0,60,0,0,0,28,0,0,0,4,0,0,0,214,255,255,255,4,0,0,0,2,0,0,0,6,0,0,0,5,0,0,0,234,255,255,255,4,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,0,0,6,0,8,0,4,0,6,0,0,0,4,0,0,0,2,0,0,0,1,0,0,0,2,0,0,0

问题重现 | Bug reproduce

如上

你的TArray<uint8> Buffer是个局部变量吧?

啊,是这个原因,我自己的问题,抱歉,感谢!