Anim Trigger not working

#pragma strict

function Start () {

var (Camera_movement) : AnimationClip; //this is your animation clip.

var (Camera) : Camera; //this is your game object that you want to move on trigger.

function OnTriggerEnter(){

animation.Play ("Camera_movement");

}

This is my code for when the player clicks on “options” on the main menu, the camera goes to a different position. The error that I get is “Assets/camera_movement.js(5,5): BCE0043: Unexpected token: (.”

Help?

Remove the parameters from the variable definitions.

var Camera_movement : AnimationClip;
var Camera : Camera;

I agree with xtro also make sure to put the variables outside of your functions and also don’t use functions as variables.

      //correct
        
        #pragma strict
         
    var Camera_movement : AnimationClip; //this is your animation clip.
         
     var cameraObj : Camera; //this is your game object that you want to move on trigger.

//Don't use functions as variables     
         
        function OnTriggerEnter(){
         
        animation.Play("Camera_movement");
         
        }

Hope I was helpful, if I wasn’t hopefully someone can give you a better answer.

Good luck :slight_smile: