Question by 
               stefanwillems · Nov 17, 2016 at 11:39 AM · 
                animationscripting problemanimatorscript.scriptingbasics  
              
 
              animation scirpting
hello,
i am working on a character animation for idle, walk and running.
i have the animator setup and it works fine. but now the scripting part.
this is what i have:
 using UnityEngine;
 using System.Collections;
 
 public class animation : MonoBehaviour
 {
     Animator m_animator;
 
     void Start ()
     {
         m_animator = GetComponent<Animator>();
     }
     
     void Update ()
     {
         bool isWalkingPressed = Input.GetKey("w");
         m_animator.SetBool("isWalking", isWalkingPressed);
     
         bool isRunningPressed = Input.GetKey("left shift" & "w");
         m_animator.SetBool("isRunning", isWalkingPressed);
     }
 }
the walking bool works fine. when i enter play mode and press W it starts to walk. the running bool isn't working. it's because of the &. how do i do this the right way?
               Comment
              
 
               
              Answer by alexanderameye · Nov 17, 2016 at 07:02 PM
Try:
 void Start()
 {
 bool isRunningPressed
 }
 
 void Update()
 {
 if(Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.LeftShift))
 {
 isRunningPressed = true;
 }
 }
Your answer
 
 
             Follow this Question
Related Questions
Outside the zone 0 Answers
In my script the Animation selection pop up shows no assets even though i have several? 0 Answers
Using same animator for multiple game objects 0 Answers
How to call Animator from another script 0 Answers
Implementing an animation command in a commands queue system 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                