Non-instant animation

Hello,

I’m beginner with unity and i’m still more a begginer for animation :slight_smile:

My problem is strange, i want change the speed of animation to négative speed for reverse the animation, that works but its not instané.

I record this :

The multiplier speed is correctly change but , i don’t understand why this is not instantaneous.

This is the code i use :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class opendoor : MonoBehaviour {
    public List<GameObject> electricite;

    public Animator aniopen;

    public bool alimente = false;

    private bool prealim = false;
    // Use this for initialization
    void Start () {
        //aniopen.speed = 0;
    }
   
    // Update is called once per frame
    void Update () {
        prealim = true;
        foreach (GameObject activateur in electricite)
        {
            if (activateur != null)
            {
                elec scriptactivateur = activateur.GetComponent<elec>();
                if (scriptactivateur.electricity == false)
                {
                    prealim = false;
                  
                }
            }
        }
        if (prealim)
        {
            alimente = true;
            aniopen.SetFloat("mouvementspeed",  1);
          

        }
        else
        {
            alimente = false;
           
            aniopen.SetFloat("mouvementspeed", - 3);

        }
        print(alimente);
    }
}

I’m not sure, but I think your animation’s current time is in the negative.
So it has to go back to 0, then it will play.