test(ui): PlayerInfoView.prefab 复用端到端结构验证
场景层级面板实证(MainMenu.scene):
- PlayerInfoView_Runtime (TS) 挂脚本 + 3 个子节点 + 3 个 Label 引用
- SceneStart_Node (TS) 挂脚本 + playerInfoView 引用到 prefab 实例
- Game View 渲染 (nickname) (bean) Label
结构层面 100% 正确。挂载链路限制:
- cocos-mcp mount_script 挂脚本后,Cocos 编辑器内部没把 scriptPath
自动转换为 prefab JSON 的 __scriptAsset 字段(uuid)
- 缺 __scriptAsset → 节点组件被降级为 cc.MissingScript
- MissingScript 时 SceneStart.getComponent('PlayerInfoView') 返回 null
→ bindTo 静默跳过,响应式链路无法端到端跑通
修复路径(需用户手动):
1. 在 Cocos 编辑器 UI 内打开 PlayerInfoView.prefab
2. Inspector 拖 PlayerInfoView.ts 到 PlayerInfoView 根节点
3. 保存 prefab → Cocos 自动写入 __scriptAsset
MCP 路径暂时无法跳过这步(无 setter 直接改 prefab JSON)。
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
"_active": true,
|
||||
"_components": [],
|
||||
"_prefab": {
|
||||
"__id__": 25
|
||||
"__id__": 31
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -57,7 +57,7 @@
|
||||
},
|
||||
"autoReleaseAssets": false,
|
||||
"_globals": {
|
||||
"__id__": 26
|
||||
"__id__": 32
|
||||
},
|
||||
"_id": "01dad306-a70d-4860-91b4-043edbbafbb2"
|
||||
},
|
||||
@@ -165,22 +165,22 @@
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
"__id__": 16
|
||||
},
|
||||
{
|
||||
"__id__": 11
|
||||
"__id__": 8
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 22
|
||||
"__id__": 28
|
||||
},
|
||||
{
|
||||
"__id__": 23
|
||||
"__id__": 29
|
||||
},
|
||||
{
|
||||
"__id__": 24
|
||||
"__id__": 30
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
@@ -213,42 +213,6 @@
|
||||
},
|
||||
"_id": "d0OZuAFOdPN4yNmWUNfH4/"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_prefab": {
|
||||
"__id__": 6
|
||||
},
|
||||
"__editorExtras__": {}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 5
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "9dd8661c-f764-4e33-b5be-47e02a7d6f41",
|
||||
"__expectedType__": "cc.Prefab"
|
||||
},
|
||||
"fileId": "",
|
||||
"instance": {
|
||||
"__id__": 7
|
||||
},
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInstance",
|
||||
"fileId": "6c4l8+giRIHozt3w35/Mqa",
|
||||
"prefabRootNode": null,
|
||||
"mountedChildren": [],
|
||||
"mountedComponents": [],
|
||||
"propertyOverrides": [],
|
||||
"removedComponents": []
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "SceneStart_Node",
|
||||
@@ -261,10 +225,10 @@
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 9
|
||||
"__id__": 6
|
||||
},
|
||||
{
|
||||
"__id__": 10
|
||||
"__id__": 7
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
@@ -303,7 +267,7 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 8
|
||||
"__id__": 5
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -325,15 +289,126 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 8
|
||||
"__id__": 5
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
"playerInfoView": {
|
||||
"__id__": 11
|
||||
"__id__": 8
|
||||
},
|
||||
"_id": "71sC3fRo9AlJB8e0yO9EEd"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"__editorExtras__": {}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 8
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "df6a5177-07a1-4bff-8b4b-eb993a81ca2f",
|
||||
"__expectedType__": "cc.Prefab"
|
||||
},
|
||||
"fileId": "3e7k7ZuV1KiLoTFpzN//Mf",
|
||||
"instance": {
|
||||
"__id__": 10
|
||||
},
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInstance",
|
||||
"fileId": "f5/b8m9ANCR5BxK8d7F5oi",
|
||||
"prefabRootNode": null,
|
||||
"mountedChildren": [],
|
||||
"mountedComponents": [],
|
||||
"propertyOverrides": [
|
||||
{
|
||||
"__id__": 11
|
||||
},
|
||||
{
|
||||
"__id__": 13
|
||||
},
|
||||
{
|
||||
"__id__": 14
|
||||
},
|
||||
{
|
||||
"__id__": 15
|
||||
}
|
||||
],
|
||||
"removedComponents": []
|
||||
},
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 12
|
||||
},
|
||||
"propertyPath": [
|
||||
"_name"
|
||||
],
|
||||
"value": "PlayerInfoView"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.TargetInfo",
|
||||
"localID": [
|
||||
"3e7k7ZuV1KiLoTFpzN//Mf"
|
||||
]
|
||||
},
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 12
|
||||
},
|
||||
"propertyPath": [
|
||||
"_lpos"
|
||||
],
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": "0",
|
||||
"y": "-100",
|
||||
"z": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 12
|
||||
},
|
||||
"propertyPath": [
|
||||
"_lrot"
|
||||
],
|
||||
"value": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 12
|
||||
},
|
||||
"propertyPath": [
|
||||
"_euler"
|
||||
],
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "PlayerInfoView_Runtime",
|
||||
@@ -344,19 +419,22 @@
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 12
|
||||
"__id__": 17
|
||||
},
|
||||
{
|
||||
"__id__": 15
|
||||
"__id__": 20
|
||||
},
|
||||
{
|
||||
"__id__": 18
|
||||
"__id__": 23
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 21
|
||||
"__id__": 26
|
||||
},
|
||||
{
|
||||
"__id__": 27
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
@@ -395,16 +473,16 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": {
|
||||
"__id__": 11
|
||||
"__id__": 16
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 13
|
||||
"__id__": 18
|
||||
},
|
||||
{
|
||||
"__id__": 14
|
||||
"__id__": 19
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
@@ -443,7 +521,7 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 12
|
||||
"__id__": 17
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -465,7 +543,7 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 12
|
||||
"__id__": 17
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -527,16 +605,16 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": {
|
||||
"__id__": 11
|
||||
"__id__": 16
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 16
|
||||
"__id__": 21
|
||||
},
|
||||
{
|
||||
"__id__": 17
|
||||
"__id__": 22
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
@@ -575,7 +653,7 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 15
|
||||
"__id__": 20
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -597,7 +675,7 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 15
|
||||
"__id__": 20
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -659,16 +737,16 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": {
|
||||
"__id__": 11
|
||||
"__id__": 16
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 19
|
||||
"__id__": 24
|
||||
},
|
||||
{
|
||||
"__id__": 20
|
||||
"__id__": 25
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
@@ -707,7 +785,7 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 18
|
||||
"__id__": 23
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -729,7 +807,7 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 18
|
||||
"__id__": 23
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -768,7 +846,7 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 11
|
||||
"__id__": 16
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
@@ -784,6 +862,27 @@
|
||||
},
|
||||
"_id": "24z5w8fUZI0bbyh+yI1od1"
|
||||
},
|
||||
{
|
||||
"__type__": "b9890v4yONA+a/v2YVJMDO5",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
"nicknameLabel": {
|
||||
"__id__": 17
|
||||
},
|
||||
"beanLabel": {
|
||||
"__id__": 20
|
||||
},
|
||||
"avatarSprite": {
|
||||
"__id__": 23
|
||||
},
|
||||
"_id": "789o7db/RIMbj3S6vsf0Ro"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
@@ -859,36 +958,36 @@
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": [
|
||||
{
|
||||
"__id__": 5
|
||||
"__id__": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"__type__": "cc.SceneGlobals",
|
||||
"ambient": {
|
||||
"__id__": 27
|
||||
},
|
||||
"shadows": {
|
||||
"__id__": 28
|
||||
},
|
||||
"_skybox": {
|
||||
"__id__": 29
|
||||
},
|
||||
"fog": {
|
||||
"__id__": 30
|
||||
},
|
||||
"octree": {
|
||||
"__id__": 31
|
||||
},
|
||||
"skin": {
|
||||
"__id__": 32
|
||||
},
|
||||
"lightProbeInfo": {
|
||||
"__id__": 33
|
||||
},
|
||||
"postSettings": {
|
||||
"shadows": {
|
||||
"__id__": 34
|
||||
},
|
||||
"_skybox": {
|
||||
"__id__": 35
|
||||
},
|
||||
"fog": {
|
||||
"__id__": 36
|
||||
},
|
||||
"octree": {
|
||||
"__id__": 37
|
||||
},
|
||||
"skin": {
|
||||
"__id__": 38
|
||||
},
|
||||
"lightProbeInfo": {
|
||||
"__id__": 39
|
||||
},
|
||||
"postSettings": {
|
||||
"__id__": 40
|
||||
},
|
||||
"bakedWithStationaryMainLight": false,
|
||||
"bakedWithHighpLightmap": false
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user