Question by 
               windmarble · Aug 12, 2016 at 03:17 PM · 
                animationscripting problemanimatoranimator controller  
              
 
              Animator is not firing transitions.
I have a PlayerMovement script attached to a game object and am trying to get the animator to fire the correct animation. However I can't seem to get it to work at all. On Awake I get the Animator component. and in the Start function I start off by setting the property HasFlashlight which should notify the animator about what set of animations to use. Though I thought I had done everything correctly. But apparently not. Any help?
 using UnityEngine;
 using System.Collections;
 
 
 public class PlayerMovementController : MonoBehaviour {
 
     private Rigidbody2D rigidBody;
     private Animator anim;
 
     public float moveSpeed; //The speed at which the player will move at
 
     /// <summary>
     /// Equipment
     /// </summary>
     /// 
 
     private bool hasFlashlight;
 
     public bool HasFlashlight {
         get {return hasFlashlight;}
         set { hasFlashlight = value;
             if(hasRifle){
                 anim.SetBool ("hasFlashlight", true);
             } else {
                 anim.SetBool ("hasFlashlight", false);
             }
         }
     }
         
     /// <summary>
     /// Actions
     /// </summary>
     private bool isWalking;
     public bool IsWalking {
         get {return isWalking;}
         set { isWalking = value;
             if(isWalking){
                 anim.SetBool ("isWalking", true);
             } else {
                 anim.SetBool ("isWalking", false);
             }
         }
     }
 
     private bool isMeleeing;
     public bool IsMeleeing {
         get {return isMeleeing;}
         set { isMeleeing = value;
             Debug.Log (@"Melee");
             if(isMeleeing){
                 Debug.Log (@"Melee - TRUE");
                 anim.SetBool ("isMeleeing", true);
             } else {
                 Debug.Log (@"Melee - FALSE");
                 anim.SetBool ("isMeleeing", false);
             }
 
         }
     }
         
     void Awake () {
         rigidBody = gameObject.GetComponent<Rigidbody2D> ();
         anim = gameObject.GetComponent<Animator> ();
     }
 
     void Start() {
         HasFlashlight = true;
     }
 
     void FixedUpdate () {
         move ();
         movementCheck ();
         melee ();
     }
 
 
     private void melee() {
         if(!IsMeleeing){
             if(Input.GetKeyDown(KeyCode.M)){
                 IsMeleeing = true;
             } else {
                 IsMeleeing = false;
             }
         }
             
     }
 
     private void move() {
         Vector2 rigV = rigidBody.velocity;
 
         //Player Movement
         if(Input.GetKeyDown(KeyCode.W)){
             rigV.y = moveSpeed;
         }
 
         if(Input.GetKeyDown(KeyCode.A)){
             rigV.x = -moveSpeed;
         }
 
         if(Input.GetKeyDown(KeyCode.S)){
             rigV.y = -moveSpeed;
         }
 
         if(Input.GetKeyDown(KeyCode.D)){
             rigV.x = moveSpeed;
         }
 
         rigidBody.velocity = rigV;
 
         //Player Rotation
         Vector3 objectPos = new Vector3(0,0,0);
         Vector3 dir = new Vector3(0,0,0);
 
         objectPos = Camera.main.WorldToScreenPoint(transform.position);
         dir = Input.mousePosition - objectPos; 
 
         transform.rotation = Quaternion.Euler(new Vector3(0,0,Mathf.Atan2(dir.y,dir.x) * Mathf.Rad2Deg ));
     
     }
 
     private void movementCheck(){
         if(!Input.GetKey (KeyCode.D) && !Input.GetKey (KeyCode.A) && !Input.GetKey (KeyCode.S) && !Input.GetKey (KeyCode.W)){
             IsWalking = false; 
             rigidBody.velocity = new Vector2(0,0);
         } else {
             IsWalking = true ; 
         }
     }
 }
 
Here is my Animator

And here is my player 
 
                 
                capturfiles-aug-12-2016-110329.png 
                (155.9 kB) 
               
 
                
                 
                capturfiles-aug-12-2016-111125.png 
                (64.0 kB) 
               
 
              
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
NEED HELP ANIMATING PLAYER MOVEMENT 0 Answers
Using same animator for multiple game objects 0 Answers
Confused about animations 1 Answer
Animator Check the end of an animation 1 Answer
Why default animation state rewrites scale of an object? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                