- Editado
Copy mecanim animations
When using the spine runtime in unity with mecanim, is there a way to copy animations?
The reason for asking is that i often reuse animations for different states, but often with slightly different animation events.
My workflow right now is that I generate an animation controller from the spine skeleton data. Beneath that AC now all the animations is, but if i try to duplicate, copy/paste, or anything of the sorts to the individual animations beneath the AC it invalidates the whole animation controller and it gets deleted from the project.
Any known workaround for this?
starfckr escribióbut if i try to duplicate, copy/paste, or anything of the sorts to the individual animations beneath the AC it invalidates the whole animation controller and it gets deleted from the project.
This behaviour is very strange, we could not reproduce that selecting and duplicating (Ctrl+D) an animation clip asset below the _Controller
asset invalidates or even deletes anything. Instead we received a copy of the same animation clip asset, but this copy is not nested under the _Controller
asset but instead added directly in the same directory at the same level as the _Controller
asset. The important part of the animation clip to work is that the name of the asset (or to be more precise: the m_Name
property in e.g. the gun-grab.anim
asset file) determines which animation will be played, and if no animation with the exact name is found, no animation will be played when a Mecanim controller state is entered with the Motion
parameter set to this animation asset.
So on our end, a workaround of duplicating the animation clip asset worked, where multiple copies unfortunately would require to be placed in separate subdirectories to allow for identical names.
I tried again now. To reproduce, I open up the nested animation controller. I click one of the animation nested below then do CTRL+D. I then get the following warnings and error messages in the console:
- Duplicated asset name 'FINAL/IDLE' contains invalid characters. Those will be replaced in the duplicated asset name.
2.Couldn't create asset file! - UnityException: Creating asset at path failed.
No clip is added to the same directly or anything.
I did state wrongly though, nothing was deleted when doing CTRL+D within the nested AC, but it does get completely scrambled when trying to copy/paste within it.
Thanks for the additional info. The animation name FINAL/IDLE
is the problem then, as a filename can't contain slashes, thus creation fails. I'm afraid I see no clean workarounds for this. You could duplicate another animation as a placeholder, rename the animation (to e.g. final_idle.anim
) and then open the asset in a text editor and change the m_Name
property to your target animation name FINAL/IDLE
. However, every time you reimport the folder or asset, the name is automatically "corrected" to match the filename, so this is annoying unfortunately and would require a version control "revert changes" (git checkout
) to undo these automatic undesired changes.
Another workaround would be to place any animations that need duplicates not within a folder in Spine.
A different workaround would be to edit the spine-unity source code accordingly to replace the slash "/"
character in any read animation name with another character, such as "_"
or the like.