Fix broken animation field paths with YAML
Fix broken target paths to renamed GameObject in animation clips in YAML
읽는 시간 2분최근 업데이트: 2달 전
Unity stores animation clips in files, which use the same YAML format as scene and prefab files.
.animAn animation clip identifies the target of each animation curve using a field. The field consists of GameObject names separated by a forward slash (). The path is relative to the GameObject that has the Animator component. For example:
pathpath/- curve: serializedVersion: 2 ... path: Hips/Spine/Shoulder/Arm
For more information about how Unity serializes data in a Scene with YAML, refer to Format of text serialized files.
When you rename a GameObject in the Hierarchy window or move it to a different parent, every curve that uses that path stops resolving. Unity doesn't raise a warning or an error in this case, neither in Edit mode, nor after you reimport the clip, nor in Play mode while the clip runs. The Animation window is the only place that reports it: the affected animation property turns yellow with appended to its name. The issue can go unnoticed because parts of the animation that don't use the renamed GameObject work as usual.
(Missing!)
Missing target GameObject in AnimationClip
Fix paths to GameObjects in YAML
A manual way to fix the paths is to edit them from the Animation window by selecting an animation property and pressing F2. Because the paths are stored separately for each animation and for each animated property within animations, you have to repeat this operation many times, and such process is error prone.
A more efficient way to update the paths in this case is to edit them in serialized YAML files.
.animUse a text search-and-replace method in the affected files to edit the necessary paths.
.anim