Hey everyone,
just a small problem, been searching for why this isnt working. I want the object to play its animations when the object is clicked.
I have this, but it doesnt play when i click it, not sure where to go with this?
#pragma strict
function OnTriggerEnter(theObject : Collider){
if(theObject.gameObject.name=="3rd Person Controller") {
animation.Play("Take001");
}
}
function OnMouseDown () {
animation.Play("Take001");
}
Please try to format your code. Either indent it one tab or four space before pasting it, or highlight it in your question and click the code button (1s and 0s). I've done it for you this time
– whydoidoitIf you insert a debug "print" statement in the OnMouseDown function, do you see that section of code being reached? It could be that the animation doesn't play because the code isn't being reached. First thing I would do is to see if the OnMouseDown code is being called.
– anon66389419Are you certain the animation is even working?
– GC1983