Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Resolved "}" and ";" Error

Discussion in 'Animation' started by SuHomunculoRiko, Feb 17, 2021.

  1. SuHomunculoRiko

    SuHomunculoRiko

    Joined:
    Feb 17, 2021
    Posts:
    4
    Hi, I dont know whats wrong with my unity but when i added to my script a Particle Stop/Play says there´s a ";" and a "}"
    Im new at this but im pretty sure im not missing anything!

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Wheel_Movement : MonoBehaviour
    6. {
    7.     AudioSource EngineSound;
    8.  
    9.     CircleCollider2D WheelContact;
    10.  
    11.     public HingeJoint2D backwheel;
    12.  
    13.     public ParticleSystem Particletest;
    14.  
    15.     JointMotor2D motorBack;
    16.  
    17.     JointMotor2D motorFront;  
    18.  
    19.     public float BackSpeed;
    20.     public float FrontSpeed;
    21.  
    22.     public float torqueB;
    23.     public float torquef;
    24.    
    25.     public bool TractionBack = true;
    26.  
    27.  
    28.  
    29.     void Start()
    30.     {
    31.        
    32.     }
    33.  
    34.     void Update() {
    35.         if (Input.GetAxisRaw("Vertical") > 0) {
    36.  
    37.             if (Input.GetKeyDown(KeyCode.W))
    38.             {
    39.                 EngineSound.Play();
    40.  
    41.                 if (Input.GetKeyUp(KeyCode.W))
    42.                 {
    43.                     EngineSound.Stop();
    44.                     play (Input.GetKeyUp(KeyCode.W))
    45.                     {
    46.                         Particletest.enableEmission = true;
    47.                     }
    48.                     else if (Input.GetKeyUp(KeyCode.W))
    49.                     {
    50.                         Particletest.enableEmission = false;
    51.                     }
    52.                 }
    53.             }
    54.  
    55.             if (TractionBack)
    56.             {
    57.                 motorBack.motorSpeed = FrontSpeed * -1;
    58.                 motorBack.maxMotorTorque = torquef;
    59.                 backwheel.motor = motorBack;
    60.             }
    61.  
    62.  
    63.         } else if (Input.GetAxisRaw("Vertical") < 0)
    64.         {
    65.  
    66.  
    67.             if (TractionBack)
    68.             {
    69.                 motorBack.motorSpeed = BackSpeed * -1;
    70.                 motorBack.maxMotorTorque = torqueB;
    71.                 backwheel.motor = motorBack;
    72.             }
    73.  
    74.  
    75.         } else {
    76.  
    77.             backwheel.useMotor = false;
    78.         }
    79.    
    80.     }
    81. }
     
  2. M-Elwy

    M-Elwy

    Joined:
    Jan 28, 2021
    Posts:
    36
    The error says you missed semicolon at the end of line 44, but I guess there should be
    if
    instead of
    play
    at the beginning of same line.
    the error message contains the line number that generates error by the way.
     
    Last edited: Feb 19, 2021
    SuHomunculoRiko likes this.
  3. SuHomunculoRiko

    SuHomunculoRiko

    Joined:
    Feb 17, 2021
    Posts:
    4
    Thanks man but, i forgot to put it as resolved im sorry but thanks!
     
unityunity