i just attach this code to my camera and try to write a reference to my animator but the code doesn’t work.i try to log the Boolean into the animator but nothing happen.the touch code works perfectly.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class touch : MonoBehaviour {
Animator anim;
void start()
{
anim = GetComponent<Animator> ();
Debug.Log(anim.GetBool("walk"));
}
void Update () {
if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Began)
{
Ray ray = Camera.main.ScreenPointToRay( Input.GetTouch(0).position );
RaycastHit hit;
if ( Physics.Raycast(ray, out hit) && hit.collider.gameObject.name=="costumer" )
{
anim.SetBool("walk",true);
}
}
}
}