fix(ui): PlayerInfoView.prefab 用 edit_enter 流程正确挂脚本

之前 memory 诊断根因为 framework/ 路径问题,经更换 cocos-mcp-server
插件后证明是旧插件 subAsset 解析 bug(无法处理 @f9941 后缀)。

新插件下 framework/ 路径也能挂脚本,真相是旧 plugin 的 bug。

但 prefab.__scriptAsset 字段缺失仍是真实问题——
cocos_prefab create 不会序列化脚本引用,必须:
1. cocos_prefab edit_enter 进入编辑模式
2. cocos_node mount_script 挂脚本(返回 runtime UUID)
3. cocos_component set_property 设 @property 引用
4. cocos_prefab edit_save → edit_exit

Cocos importer 会自动合并重复的 __type__ 块,只保留
runtime UUID 块作为权威。MissingScript 在挂脚本后被替换。

控制台 0 错误,响应式验证场景(SceneStart + mock session +
view.bindTo)端到端跑通,prefab 可独立复用。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-01 06:45:11 +08:00
co-authored by Claude Opus 5
parent 5514366af7
commit b32613dd34
2 changed files with 44 additions and 30 deletions
@@ -45,8 +45,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": "0",
"y": 100, "y": "-100",
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -95,8 +95,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": "0",
"y": 50, "y": "50",
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -148,7 +148,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "OqsxQHKUEDc8ismoShpIf7" "fileId": "CBolwaLb/iXsRfiYG/N/3s"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
@@ -216,7 +216,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "H9oJa64UHynJ09/BTRY3F5" "fileId": "e6IIAzeRnDBTlXhIuHJ0ls"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -226,7 +226,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "8a3UixwStPLYw7wpJxpnx2", "fileId": "bdtAP7JtVCEbM8ECGGK/p0",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -254,8 +254,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": "0",
"y": 0, "y": "0",
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -307,7 +307,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "Xh/p8USrolqm7IUmIM90dY" "fileId": "ZYsO7P8u1rGItVnCXkdaCU"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
@@ -375,7 +375,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "LGYEulOEhq+LPsLSc/MEQ9" "fileId": "j2zq4VGHYwGIRSgM2OvD/6"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -385,7 +385,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "61AFDU71BAZr2SwfHXHyax", "fileId": "c1yfHrAqNGVrPzKdCHKo1J",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -413,8 +413,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -200, "x": "-200",
"y": 0, "y": "0",
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -454,19 +454,19 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 100, "width": 40,
"height": 100 "height": 36
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": "0",
"y": 0.5 "y": "0.5"
}, },
"_id": "" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "ZYNPCDZ+Jbx6UXJb/pJjOf" "fileId": "PF79iHnHXKWCqnUmN7YrU0"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
@@ -511,7 +511,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "2QdWsCiVAB7EPHIzNQXWcy" "fileId": "EWIKGJcxph2RQ5daWQuPgt"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -521,7 +521,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "e53bB0bJBJzLpv7auU9mgB", "fileId": "c6dZktHNJMNoztQHZvHf2F",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -540,8 +540,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 500, "width": 100,
"height": 200 "height": 100
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -552,7 +552,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "yDvEeV3IvE8TAwviyJM8Bj" "fileId": "y7NHSwQo2QkgmRmTmpYBca"
}, },
{ {
"__type__": "PlayerInfoView", "__type__": "PlayerInfoView",
@@ -566,19 +566,19 @@
"__id__": 23 "__id__": 23
}, },
"nicknameLabel": { "nicknameLabel": {
"uuid": "8a3UixwStPLYw7wpJxpnx2" "uuid": "bdtAP7JtVCEbM8ECGGK/p0"
}, },
"beanLabel": { "beanLabel": {
"uuid": "61AFDU71BAZr2SwfHXHyax" "uuid": "c1yfHrAqNGVrPzKdCHKo1J"
}, },
"avatarSprite": { "avatarSprite": {
"uuid": "e53bB0bJBJzLpv7auU9mgB" "uuid": "c6dZktHNJMNoztQHZvHf2F"
}, },
"_id": "" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "m5Phmi1gu84B84JJS5XcHd" "fileId": "c2tNehZHa9gREUUqhm5d6j"
}, },
{ {
"__type__": "b9890v4yONA+a/v2YVJMDO5", "__type__": "b9890v4yONA+a/v2YVJMDO5",
@@ -605,7 +605,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "29A3ICE8hAga+sRYGXOpM7" "fileId": "602ZEXBwFOWIV5QWu0o1i3"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -615,7 +615,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "dflMFKQ9RAybmIkPF8a3Q5", "fileId": "3e7k7ZuV1KiLoTFpzN//Mf",
"instance": null, "instance": null,
"targetOverrides": null "targetOverrides": null
} }
@@ -0,0 +1,14 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "df6a5177-07a1-4bff-8b4b-eb993a81ca2f",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "PlayerInfoView",
"hasIcon": false
}
}