From faf040002d113d2e8fb25d2bb81bbd9066ee2f18 Mon Sep 17 00:00:00 2001 From: bofeng-song Date: Thu, 17 Feb 2022 15:48:40 +0800 Subject: [PATCH] fix octree's minPos can't not be read normally while deserialize (#10112) * fix octree's minPos can't not be read normally while deserialize --- cocos/core/data/deserialize.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cocos/core/data/deserialize.ts b/cocos/core/data/deserialize.ts index 10f4d10e1b..0fc2d684dc 100644 --- a/cocos/core/data/deserialize.ts +++ b/cocos/core/data/deserialize.ts @@ -750,7 +750,17 @@ function parseCustomClass (data: IFileData, owner: any, key: string, value: ICus } function parseValueTypeCreated (data: IFileData, owner: any, key: string, value: IValueTypeData) { - BuiltinValueTypeSetters[value[VALUETYPE_SETTER]](owner[key], value); + /**BuiltinValueTypes index: Vec2=0, Vec3=1, Vec4=2, Quat=3, Color=4, Size=5, Rect=6, Mat4=7 + The native layer type corresponding to the BuiltinValueTypes has not been exported exclude Color, + so we need to set to native after value changed + * */ + if (JSB) { + const tmp = owner[key]; + BuiltinValueTypeSetters[value[VALUETYPE_SETTER]](tmp, value); + owner[key] = tmp; + } else { + BuiltinValueTypeSetters[value[VALUETYPE_SETTER]](owner[key], value); + } } function parseValueType (data: IFileData, owner: any, key: string, value: IValueTypeData) {