0
\$\begingroup\$

When I interrupt an Animator Controller during an Animation and reopen it the Armature gets stuck (more or less) at the point where the previous Animation was interrupted. How can I safely and instantly quit an animation without destroying it?

Please watch the Video to fully comprehend the problem: https://youtu.be/O9X5SBATHRw

Screenshot of Problem:

enter image description here

Screenshot of Animator Controller:

enter image description here

Part of the Weapon Switch Script:

disableWeaponModel(weaponNameList[activeWeapon]); //Disable active Weapon Model

if (holsteredWeapon == -1) //If player carries only 1 weapon
    holsteredWeapon = activeWeapon; //Active Weapon is holstered
else //Player already carries 2 weapons
    actionDropGun(); //Active Weapon is thrown (New LOD generated)

activeWeapon = getWeaponIDfromLOD(targetName); //Active Weapon is set to Target LOD

setWeaponVars(activeWeapon); //Set all variables to the active Weapon
setWeaponModel(weaponNameList[activeWeapon]); //Set Weapon Model to the active Weapon
setAnimator(weaponNameList[activeWeapon]); //Set Animations to the active Weapon

setAnimator(string name) Function from above (last code line):

void setAnimator(string name)
{
    //Add new guns here
    if (name == "MP5A3")
        currentWeaponAnimation = MP5A3_Animation;
    else if (name == "Rpk-74")
        currentWeaponAnimation = Rpk74_Animation;
    else if (name == "Skorpion")
        currentWeaponAnimation = Skorpion_Animation;
}

Variables from setAnimator(string name):

enter image description here

\$\endgroup\$
1
\$\begingroup\$

Turning on Optimize Game Objects on the Rig tab of your model fixed this for me (Generic/Humanoid animations only). The only problem is that it won't work for you, if you actually need the model bones as gameobjects.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.