Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Make a blend tree update to unscaled.

Discussion in 'Animation' started by Lex_212, Apr 20, 2022.

  1. Lex_212

    Lex_212

    Joined:
    Oct 3, 2020
    Posts:
    84
    Hi, I currently trying to use a blend tree to change between animations and changing the value Blend using this script:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class CharacterAnimator : MonoBehaviour
    6. {
    7.     const float smoothTime = 0.1f;
    8.  
    9.     CharacterController controller;
    10.     Animator animator;
    11.     public Movimiento movement;
    12.     // Start is called before the first frame update
    13.     void Start()
    14.     {
    15.         controller = GetComponent<CharacterController>();
    16.         animator = GetComponentInChildren<Animator>();
    17.     }
    18.  
    19.     // Update is called once per frame
    20.     void Update()
    21.     {
    22.         float speedPertence = controller.velocity.magnitude / movement.maximumSpeed;
    23.         animator.SetFloat("Blend", speedPertence, smoothTime, Time.unscaledDeltaTime);
    24.     }
    25. }
    26.  
    I want the animator to not react to changes on Time.timeScale, but it doesn't seem to work. The animator's update is set to unscaled time so the problem should be in that script.