Question by
jonahsrocket · Sep 29, 2016 at 07:41 PM ·
triggeranimationsclickonmousedownonclick
Play more animations onclick
Hi there,
I want to to play two animations at the same time when someone mouseclicks on something. Is it possible to this within the void OnMouseDown? This is what I have but it doesn't work.
using UnityEngine;
using System.Collections;
public class LiftOmhoog : MonoBehaviour
{
public Animator anim;
void OnMouseDown()
{
anim.SetTrigger("NaarBoven");
anim.SetTrigger("LiftOmhoog");
}
}
Thanks in advance for answering!
Cheers,
Jonah
Comment
Answer by Astrydax · Sep 30, 2016 at 11:49 PM
Seems like you need control layers. This should do the trick.
https://unity3d.com/learn/tutorials/topics/animation/animator-controller-layers
Alternatively you could use blend trees
https://unity3d.com/learn/tutorials/topics/animation/blend-trees?playlist=17099
Your answer
Follow this Question
Related Questions
2D - OnMouseDown not working despite having a collider 0 Answers
Assign UI-Button position to Object? 0 Answers
UI buttons sometimes does not detect touch 0 Answers
Click Button and Follow Mouse 1 Answer