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

Assets\MouseLook.cs(25,47): error CS1002: ; expected

Discussion in 'Scripting' started by ChewBlocker, Aug 22, 2020.

  1. ChewBlocker

    ChewBlocker

    Joined:
    Aug 22, 2020
    Posts:
    8
    I don't know how to fix this please help
    here is my code

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class MouseLook : MonoBehaviour
    6. {
    7.  
    8.  
    9.     public float mouseSensitivity = 100f;
    10.  
    11.     public Transform playerBody;
    12.  
    13.     // Start is called before the first frame update
    14.     void Start()
    15.     {
    16.        
    17.     }
    18.  
    19.     // Update is called once per frame
    20.     void Update()
    21.     {
    22.         float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    23.         float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
    24.  
    25.         playerBody.Rotate(Vector3,up * mouseX)
    26.     }
    27. }
     
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,497
    On line 25, you need to add a ";" like this:
    Code (CSharp):
    1. playerBody.Rotate(Vector3,up * mouseX);
    Edit: Your error tells you the line and where. "Assets\MouseLook.cs(25,47)" means on line 25, 47 characters over :)
     
  3. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,723
    On the same line (25) you also have a comma where you should be using a period:
    Code (CSharp):
    1. Vector3,up
    should be
    Code (CSharp):
    1. Vector3.up
     
    adamgolden likes this.
  4. ChewBlocker

    ChewBlocker

    Joined:
    Aug 22, 2020
    Posts:
    8
    yea found that out new to programming thank you tho
     
    Last edited: Aug 22, 2020