0

I am working on a C# script to modify Animation Controllers in Unity3D 4.1 from code. Therefore I parse the controller using the YamlDotNet yaml parser but I am running into an error when trying to parse the controller file.

I tried it with other yaml examples and it works fine, but the controllers have some special tags next to the --- which seem to cause the parser to run into a SemanticErrorException.

Please see the following code which represents some lines of the AnimationController yaml file:

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
(...)
--- !u!1101 &110100000

Parsing a file looking similar to the following example works just fine:

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
---
AnimatorController:
(...)
---

I was looking for a solution in the yaml specification for 1.1. and 1.2 but I still don't understand what these tags represent and how they are interpreted.

yaml.org/spec/1.1/

yaml.org/spec/1.2/

Can somebody explain me these tags and maybe also how I can still parse the AnimationController using a parser without the need of writing my own yaml parser.

Any help is appreciated! Thanks!

Greets

Thomas

Thomas Mondel
  • 1,944
  • 3
  • 20
  • 25

2 Answers2

0

How about using the AnimatorController class in UnityEditorInternal? It provides all the methods required to create and modify AnimatorController assets and everything seems to be public as well. Seems to be a better approach than modifying the Yaml code, especially since you don't have any Yaml code in Unity Free, which doesn't support text serialization mode of assets.

Also the API is probably more stable than the serialization format.

Jan Thomä
  • 13,296
  • 6
  • 55
  • 83
0

having the same problem parsing a unity scene yaml.

Can somebody explain me these tags

from Unity Manual>Advanced>Textual Scene File Format>Description of the Format

--- !u!1 &6 ... The first line contains the string "!u!1 &6" after the document marker. The first number after the "!u!" part indicates the class of the object (in this case, it is a GameObject). The number following the ampersand is an object ID number which is unique within the file, although the number is assigned to each object arbitrarily.

I guess this is non standard Yaml?

Logan Bender
  • 367
  • 1
  • 5
  • 12