Easy replacement of animations in Controller and Blendshapes

Hello,

it happened with 4 assets that I purchased from the Unity asset store that the developer created big sub-state machines with many animations, and users want to replace the animations with their own.

I would like to ask if there is an easy way to replace them without having to do everything manually.

In my desperation, I tried locating the animation names in the Unity project files in order to replace them with a text search, but I didn’t even find the animation names in any of the files.

Can anybody help with a helpful idea?

Thank you very much!

the easiest way to replace animations from a controller is to use an override controller

good luck

@Mecanim-Dev

Thank you. I was hoping for a click-and-select solution.

I think the AnimatorOverrideController is just as time-taking as replacing the animations manually.

Can you tell me in which file the used animation names are stored? Then I could parse them and replace them and perhaps even make a selection window myself.

they are stored in .controller asset file.

To edit them you will to switch your editor setting asset serialization mode to Force Text
in each AnimatorState block there is a m_Motion field that define which animation clip is used.
You will need to find those fileid and change them.
unfortunatelly they are not saved simply as a name but as fileid

here a controller example with one state called WIN00

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_Name: New Animator Controller
  serializedVersion: 5
  m_AnimatorParameters: []
  m_AnimatorLayers:
  - serializedVersion: 5
    m_Name: Base Layer
    m_StateMachine: {fileID: 1107730664872256572}
    m_Mask: {fileID: 0}
    m_Motions: []
    m_Behaviours: []
    m_BlendingMode: 0
    m_SyncedLayerIndex: -1
    m_DefaultWeight: 0
    m_IKPass: 0
    m_SyncedLayerAffectsTiming: 0
    m_Controller: {fileID: 9100000}
--- !u!1102 &1102719403726666966
AnimatorState:
  serializedVersion: 5
  m_ObjectHideFlags: 1
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_Name: WIN00
  m_Speed: 1
  m_CycleOffset: 0
  m_Transitions: []
  m_StateMachineBehaviours: []
  m_Position: {x: 50, y: 50, z: 0}
  m_IKOnFeet: 0
  m_WriteDefaultValues: 1
  m_Mirror: 0
  m_SpeedParameterActive: 0
  m_MirrorParameterActive: 0
  m_CycleOffsetParameterActive: 0
  m_Motion: {fileID: 7400000, guid: e2538d48c03da46a8b0c3b59d39a4cab, type: 3}
  m_Tag:
  m_SpeedParameter:
  m_MirrorParameter:
  m_CycleOffsetParameter:
--- !u!1107 &1107730664872256572
AnimatorStateMachine:
  serializedVersion: 5
  m_ObjectHideFlags: 1
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_Name: Base Layer
  m_ChildStates:
  - serializedVersion: 1
    m_State: {fileID: 1102719403726666966}
    m_Position: {x: 372, y: 155, z: 0}
  m_ChildStateMachines: []
  m_AnyStateTransitions: []
  m_EntryTransitions: []
  m_StateMachineTransitions: {}
  m_StateMachineBehaviours: []
  m_AnyStatePosition: {x: 50, y: 20, z: 0}
  m_EntryPosition: {x: 50, y: 120, z: 0}
  m_ExitPosition: {x: 800, y: 120, z: 0}
  m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
  m_DefaultState: {fileID: 1102719403726666966}

@Mecanim-Dev Thank you. Can you tell me where I would find the fileID mapping?

it everywhere in your asset file,for animation clip you need to open the asset file containing your animation clip, inside this file you shoudl find the fileid.

in the previous example you can see the fileid of the animation state WIn00 at line 24
— !u!1102 &1102719403726666966
and referenced at line 56 in the animationstate list
and line 67 as the defautl state

1 Like

Tim from Ootii has solved this problem excellently. He found a way to serialize entire blendtrees. It was shown in one of his videos, but I currently don’t find it, there are too many of his videos on YouTube. :slight_smile: