Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
thomation opened this issue Jun 12, 2019 · 2 comments
Open

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

thomation opened this issue Jun 12, 2019 · 2 comments

Comments

@thomation
Copy link

@thomation thomation commented Jun 12, 2019

"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}
@DouglasUrner
Copy link

@DouglasUrner DouglasUrner commented Feb 26, 2020

I'm wondering how to solve this one too. Unity clearly thinks that the scope of a TAG directive is from the point of declaration to the end of the file. It appears that Psych thinks the scope extends only to the end of the document. Is there a "right" interpretation?

@ROFISH
Copy link

@ROFISH ROFISH commented Jun 3, 2020

I've seen other YAML parsers with a "default tag" that could be set. Is there not one in psych?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.