Search Unity

How to solve this error :TankMovement.cs(66,17): error CS1525: Unexpected symbol `{'

Discussion in 'Getting Started' started by Angrykook, Jan 12, 2016.

  1. Angrykook

    Angrykook

    Joined:
    Jan 12, 2016
    Posts:
    7
    I also get the following error from my code :

    Assets/Scripts/Tank/TankMovement.cs(74,28): error CS8025: Parsing error

    Here is my code :

    private void EngineAudio()
    {
    // Play the correct audio clip based on whether or not the tank is moving and what audio is currently playing.

    if (Mathf.Abs (m_MovementInputValue) < 0.1f && Mathf.Abs (m_TurnInputValue < 0.1f)
    {
    if (m_MovementAudio.clip == m_EngineDriving)
    {
    m_MovementAudio.clip = m_EngineIdling ;
    m_MovementAudio.pitch = Random.Range (m_OriginalPitch - m_PitchRange, m_OriginalPitch + m_PitchRange) ;
    m_MovementAudio.Play () ;
    }
    }
    else
    {
    if (m_MovementAudio.clip == m_EngineIdling)
    {
    m_MovementAudio.clip = m_EngineDriving ;
    m_MovementAudio.pitch = Random.Range (m_OriginalPitch - m_PitchRange, m_OriginalPitch + m_PitchRange) ;
    m_MovementAudio.Play () ;
    }
    }
    }
     
  2. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    What it is saying is that your code can't be read. This usually means you have to many or not enough {}, to many or not enough(), or are missing a ; somewhere.

    Also, that isn't the whole code (& please use code tags to make it easier to read). By posting the whole code & using code tags the error message line numbers will line up with the line numbers shown in the code insert. In your case, go to the line specified & start checking for those items I first mentioned. The error can be in lines prior to the line in the error, that line is just at the point the system realised there was an error.
     
    jhocking and JoeStrout like this.
  3. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Can you please use code tags when posting code on the forums:

    http://forum.unity3d.com/threads/using-code-tags-properly.143875/