Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Got "found undefined tag" error on parsing prefab file of unity3d

未关闭
#404 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
ruby, yaml
领域
tooling

调研方向

从 Psych.parse_stream 和提供的 Unity YAML 开始,重点检查第 21 行的文档边界及其 %TAG 指令。重现 Psych::SyntaxError,然后检查多文档指令和标签的处理方式。完成的标准是:示例无需预处理即可通过 API 解析,并且为所提供的输入添加回归测试。

由索引模型根据 Issue 内容生成。

描述

"found undefined tag handle while parsing a node at line 21 column 5 (Psych::SyntaxError)"
I got this error on parsing unity3d prefab file with parse_stream method.

Psych.parse_stream(yaml, filename: path) do |node|
       puts node
end

line 21 is " --- !u!224 &224286004637740336"
I can insert a new line "%TAG !u! tag:unity3d.com,2011: " before every "---" to fix it.

source.gsub(/^(?<!%TAG !u! tag:unity3d.com,2011:\n)^(--- !u![0-9]+ &[0-9]+)$/, "%TAG !u! tag:unity3d.com,2011:\n\\1")

But I hope there is a solution in API level.

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1007462957078648
GameObject:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  serializedVersion: 6
  m_Component:
  - component: {fileID: 224286004637740336}
  - component: {fileID: 222770377023727128}
  - component: {fileID: 114746315234884256}
  m_Layer: 5
  m_Name: Icon
  m_TagString: Untagged
  m_Icon: {fileID: 0}
  m_NavMeshLayer: 0
  m_StaticEditorFlags: 0
  m_IsActive: 1
--- !u!224 &224286004637740336
RectTransform:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 1007462957078648}
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
  m_LocalPosition: {x: 0, y: 0, z: -1.3}
  m_LocalScale: {x: 0.7, y: 0.7, z: 0.9996802}
  m_Children: []
  m_Father: {fileID: 224567198966254662}
  m_RootOrder: 0
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
  m_AnchorMin: {x: 0.5, y: 0.5}
  m_AnchorMax: {x: 0.5, y: 0.5}
  m_AnchoredPosition: {x: 45.3, y: -79.2}
  m_SizeDelta: {x: 132, y: 132}
  m_Pivot: {x: 0.5, y: 0.5}
主要语言
Ruby
星标
597
派生
223
平均合并
6 小时 8 分钟
30 天内合并 PR
2

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby/psych 的其他 Issue

查看 ruby/psych 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。