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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    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:
    72
    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.