Search Unity

error "Assets/Scripts/PlayerController.cs(14,25): error CS1525: Unexpected symbol `rigidbody'"

Discussion in 'Editor & General Support' started by Allie_98, May 21, 2015.

  1. Allie_98

    Allie_98

    Joined:
    May 21, 2015
    Posts:
    15
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. public class PlayerController : MonoBehaviour
    5. {
    6.     void FixedUpdate()
    7.     {
    8.         float moveHorizontal = Input.GetAxis("Horizontal");
    9.         float moveVertical = Input.GetAxis("Vertical");
    10.         Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical)
    11.         rigidbody.velocity= movement;
    12.     }
    13. }
    14.  
    Unity refuses to recognize the code "rigidbody.velocity".... I have followed every single step that the tutorials do and my code still won't work! Please help!!! I have had friends, and my teachers look over my project and no one understands what is going on.
    I keep getting the error;
    Assets/Scripts/PlayerController.cs(14,25): error CS1525: Unexpected symbol `rigidbody'
    :(:(:(:(:(
    What have i done wrong????

    @adambuckner
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    There is no semicolon at the end of line 10. The error message is a bit misleading in this case.
     
  3. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
  4. Allie_98

    Allie_98

    Joined:
    May 21, 2015
    Posts:
    15
    Thanks I can't believe I missed that