Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

How to play a running animation when my character is moving

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

  1. tpj


    Jun 8, 2021
    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;
    5. public class animations : MonoBehaviour
    6. {
    7.     // Start is called before the first frame update
    8.     void Start()
    9.     {
    11.     }
    13.     // Update is called once per frame
    14.     void Update()
    15.     {
    16.         bool Running = Input.GetAxis("Horizontal");
    17.     }
    18. }
    please help