Hello I have such objects in the scene: collider (that acts as trigger), elevator, animated button. Now when I enter the collider area and press f button and then get into elevator it goes up. I want make it so that when i enter the collider area and press f button the animation of other object named animated button will play too. I have such code for now.
This does not work as I get error: MissingComponentException: There is no 'Animation' attached to the "aktywator_windy" game object, but a script is trying to access it.
Can someone tell me how to fix it (make it work)?
Maybe this ugly picture will help it understand better:
where is ur script attached? and where is ur animation.? in that script u r tryin to acces an animation in the object where the script is attached. so u might need to call the correct gameObject to play the animation. `gameObject.FindWithTag("player");` or u can make a variable `var animated : GameObject;` and add ur player in the inspector anyway u want will work.
but remember that the object must contain the animation component with its animation.
srry for the confusing bad english. xD
answered Aug 20 '12 at 05:18 PM
Ok problem solved thanks again the correct code goes like this for me
Everything works fine now