i got a bit of a problem here everything works EXCEPT for the animation wont play since i cant make it link the animation to the animation.Play(“open1”);
anyone know how to? the script looks like this and the script is put on a collider a child of Door
using UnityEngine;
using System.Collections;
public class ActivateDoor : MonoBehaviour {
public Transform door; // select the door in the inspector
private bool colidingThisDoor = false;
void Start () {
// select the parent as the door, as adviced, if it wasn't manually set
if (door == null) {
door = transform.parent;
}
}
void OnTriggerEnter (Collider other) {
colidingThisDoor = true;
}
void OnTriggerExit(Collider other) {
colidingThisDoor = false;
}
void Update () {
if (colidingThisDoor) {
if (Input.GetKeyDown("e")){
// Debug.Log ("E was pressed for door "+ door.name +" on collider "+ transform.name);
animation.Play("open1");
}
}
}
}
thanks alot in advance!