Hi everybody,
in my project I have a door that opens when I mouseclick on it. This works. Now I want it to close when I click it again. For that I want to use the code ‘anim.SetTrigger(“deurdicht”);’’
I think it should be and if/else statement but I can’t figure it out. This is the code I have so far.
using UnityEngine;
using System.Collections;
public class ScriptLoop : MonoBehaviour
{
public Animator anim; //anim kan ook een andre naam zijn, is willekurig
// Use this for initialization
void Start()
{
}
void Update()
{
}
void OnMouseDown()
{
anim.SetTrigger("deuropen");
}
}
I hope that someone can help me out. Thanks in advance!
Cheers,
Jonah