Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to play a running animation when my character is moving

Discussion in 'Animation' started by tpj, Jun 8, 2021.

  1. tpj

    tpj

    Joined:
    Jun 8, 2021
    Posts:
    1
    I cant seem to figure this out. On different threads there is a answer but it does not work for me.
    At the moment i have a state in the animator called running and one called idle. The two transitions are based on if the bool running is true or false. I am trying to get the bool to change values by this script
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class animations : MonoBehaviour
    6. {
    7.     // Start is called before the first frame update
    8.     void Start()
    9.     {
    10.        
    11.     }
    12.  
    13.     // Update is called once per frame
    14.     void Update()
    15.     {
    16.         bool Running = Input.GetAxis("Horizontal");
    17.     }
    18. }
    19.  
    please help