hey guys,
I have a quick question,
I want the player to step on a trap and then that triggers 4 doors to move. The animation is attached to the trigger. it is set as a tigger with a box collider and everything. The issue is the animation just plays when the game is played. the animation is always playing.this is not what i want.
Here is the script I have, but it doesn’t do what it should.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class TrapTrigger : MonoBehaviour
{
public GameObject Trigger;
public Animator anim;
void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
Trigger.GetComponent<Animator>().Play("doortrap");
anim.GetComponent<Animator>().Play("doortrap");
}
}
}
any help is welcomed.