Sometimes you may get following errors:Unable to parse YAML file: [mapping values are not allowed in this context] at line 1
or
Unable to parse YAML file: [could not find expected ‘:’] at line 2
Both of those errors usually caused by version control system (eventually by user).
In first case svn added <<<<<<< .mine
in to .meta file after conflict.
In second case it was git, added text to highlight conflict.
To fix those errors you just need to go though all .meta files and fix svn or git conflicts.
For git you can use ruby script that you can find on Ashley Whetter’s Blog
For svn just adapt ruby script to look for “<<<<” inside files instead of “:” or write your own script
Recently I came across the following error when working on a group Unity3D project:
Unable to parse YAML file: [could not find expected ':'] at line 2
We had no yaml files (that we knew of) and Unity could still build and run the project so this error seemed a bit odd.
It turns out that the error was caused by git adding text to highlight a conflict in some of Unity's .meta files. So fixing the error was just a case of finding the meta files and resolving the conflicts.
I used this ruby script to find the files that needed to be fixed. Just place the script in the root of the Unity project and run it. It'll print the locations of the broken files.
ruby源码
require 'find'metafiles = []
Find.wd()) do |path|metafiles << path if path =~ /.*.meta$/
endmetafiles.each do |fileloc|file = File.open(fileloc)line = nil2.times{line = s}puts fileloc if not line =~ /.*:.*/file.close
end
本文发布于:2024-01-27 23:48:19,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/17063705173378.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |