so i was wondering if i can trigger an animation by an another gameobject being animated in the scene since it got collider and stuff it does not seem to work any one know if it works or not
Just info
I got myb same issue short time ago
It didn’t show collision, but when I in runtime with unity editor moved object forward-backward it was detected
use something like this check the state of animation running and trigger animation this works for me
using UnityEngine;
using System.Collections;
public class statecheck : MonoBehaviour {
Animator anim;
public Animator []playstuff;
public GameObject []sh;
public bool check;
// Use this for initialization
void Start (){
anim = GetComponent<Animator>();
}
void FixedUpdate ()
{
AnimatorStateInfo stateInfo = anim.GetCurrentAnimatorStateInfo(0);
if (stateInfo.IsName("u_s")){
Debug.Log("Do Stuff Here");
playstuff [0].SetBool ("bd",true);
}
if (stateInfo.IsName("n_s")){
Debug.Log("Do Stuff Here");
playstuff [1].SetBool ("bd",true);
}
if (stateInfo.IsName("light of")){
Debug.Log("Do Stuff Here");
sh[0].SetActive (check);
sh[1].SetActive (check);
}
if (stateInfo.IsName("door")){
Debug.Log("Do Stuff Here");
playstuff [3].SetBool ("bd",true);
}
if (stateInfo.IsName("flash")){
Debug.Log("Do Stuff Here");
playstuff [2].SetBool ("bd",true);
}
}
}