Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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.