I have no ideer how to fix this. What I want, is my dooranimation to play (open) when my cube collider enters this squared triggerzone i have created. And yes, I have marked my triggerzone, “Is trigger”. In the picture below is my animator setting for my “Platformtrigger”- animatorcontroller. I assumed that i needed a boolean parameter to make something trigger, so i have a bool called, “Play”, and it’s set to false. Hopefully there’s a kind soul out there who would like to help me. I would really really appreciate it, since i have been stuck with this for a while.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlatformTrigger : MonoBehaviour
{
private Animator animator;
public bool Play;
public Animation DoorOpen;
void Start()
{
//DoorOpen = GetComponent<Animation> ();
animator.enabled = true;
animator.SetBool ("Play", false);
Debug.Log ("It works!");
}
void OntriggerStay(Collider Cube)
{
if (Cube.gameObject.tag == "Cube") {
animator.SetBool ("Play", true);
Debug.Log ("TriggerStay doesn't work");
//DoorOpen.Play ("DoorOpen");
//} else {
//animation.Play ("DoorOpen" = false);
}
}
}