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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Unity code error

Discussion in 'Scripting' started by Indie_Dev_26, Jul 23, 2022.

  1. Indie_Dev_26

    Indie_Dev_26

    Joined:
    Jul 23, 2022
    Posts:
    3
    I am getting a unity code error: Assets\Scripts\MouseLook.css(10,32): error CS1002: ; expected. but when I look at my code I don't see the issue any help/advice would be greatly appreciated.

    Here's my code

    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class MouseLook : MonoBehaviour
    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. }
    28. [\CODE]
     
    Last edited: Jul 23, 2022
  2. RadRedPanda

    RadRedPanda

    Joined:
    May 9, 2018
    Posts:
    1,596
    When posting code on the forum, make sure to use Code Tags. You can still edit your post to fix it.

    I didn't immediately notice anything wrong with your code, did you make sure to save it?
     
  3. Indie_Dev_26

    Indie_Dev_26

    Joined:
    Jul 23, 2022
    Posts:
    3
    I saved it multiple times and even reimported it in unity but im still getting the error so im really not sure whats wrong with it im still trying to learn code.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    MouseLook.css ... ??

    That doesn't seem cricket.
     
  5. Indie_Dev_26

    Indie_Dev_26

    Joined:
    Jul 23, 2022
    Posts:
    3
    I just named it that but i found the issue even though i updated the code and saved it. it did not update in unity so i had to open the script and then correct it and save.