Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unexpected symbol error

Discussion in 'Scripting' started by adfg, Feb 26, 2015.

  1. adfg

    adfg

    Joined:
    Feb 26, 2015
    Posts:
    2
    Hi, I've been trying to make a door for a while, and recently found this video.

    I followed everything the video said, but still came up with two errors.
    Assets/Doors.cs(12,32): error CS1525: Unexpected symbol `animator'
    Assets/Doors.cs(20,35): error CS1525: Unexpected symbol `DoorControl'

    And my code is

    Code (CSharp):
    1.  using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Doors : MonoBehaviour {
    5.  
    6.     Animator animator;
    7.     bool doorOpen;
    8.  
    9.     void Start()
    10.     {
    11.             doorOpen = false
    12.             animator = GetComponent<Animator>();
    13.     }
    14.  
    15.         void OnTriggerEnter(Collider col)
    16.     {
    17.         if(col.gameObject.tag == "Player")
    18.         {
    19.             doorOpen = true
    20.             DoorControl ("Open")
    21.         }
    22.     }
    23.  
    24.         void OnTriggerExit(Collider col)
    25.     {
    26.         if (doorOpen)
    27.         {
    28.             doorOpen = false;
    29.             Doors ("Close");
    30.         }
    31.     }
    32.  
    33.     void DoorControl(string direction)
    34.     {
    35.         animator.setTrigger(direction);
    36.     }
    37. }
    Any help would be great!
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You forgot the semicolon at the end of line 11 which lead to the error at line 12. Exactly the same is the case for the next error message.
     
  3. adfg

    adfg

    Joined:
    Feb 26, 2015
    Posts:
    2
    Oh, really? Wow, stupid mistakes. Thanks!