Search Unity

Resolved Problem with the Inspector

Discussion in 'Editor & General Support' started by Deleted User, Mar 15, 2021.

  1. Deleted User

    Deleted User

    Guest

    Hello! I am a small hobby dev and I got a problem with me inspector, It won't show the variables, but I need to set them. When I try to execute the program it throws "You need to fix the scripts first" at me
    This is my code:
    Code (CSharp):
    1. using System.Collections;
    2. using System;
    3. using UnityEngine;
    4.  
    5. public class mouseLook : MonoBehaviour
    6. {
    7.     public float mouseSensitivity = 100f;
    8.     public Transform playerBody;
    9.     public float xRotation = 0f;
    10.  
    11.  
    12.     void Start()
    13.     {
    14.         Cursor.lockState = CursorLockMode.Locked;
    15.     }
    16.     void Update()
    17.     {
    18.         float mouseX = Input.GetAxis("Mouse X") *  this.mouseSensitivity * Time.deltaTime;
    19.         float mouseY = Input.GetAxis("Mouse Y") *  this.mouseSensitivity * Time.deltaTime;
    20.        
    21.         xRotation -= mouseY;
    22.         xRotation = Mathf.Clamp(xRotation, -90f, 90f);
    23.         transform.localRotation = Quaternion.Euler(xRotation, 0f,0f)
    24.         playerBody.Rotate(Vector3.up*mouseX);
    25.     }
    26. }
    27.  
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,911
    You have compile errors. They may or may not be related to this particular script.

    You need to look through your console window and resolve any red compile errors. Until you do that, Unity will not be able to compile your code and any new variables you added will not show up in the inspector.
     
  3. Deleted User

    Deleted User

    Guest

    Problem with that is, it doesn't show any errors
    Neither MSVSC nor Unity does
     
  4. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,911
    Show a screenshot of your console window, especially including the small toggles at the top right of it?
     
  5. Deleted User

    Deleted User

    Guest

    which console Unity or MS?
     
  6. Deleted User

    Deleted User

    Guest

    mouse.JPG Capture.JPG
    And befor you ask, the error only points at the script.
     
  7. Deleted User

    Deleted User

    Guest

    this is how the inspector looks like:
    inspec.JPG
     
  8. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,911
    See that little red icon on the top right of your console? You have an error, but errors are hidden in your console at the moment. Click that red icon to show the error.
     
  9. Deleted User

    Deleted User

    Guest

    And as I have said, that's the error message that says, that the script is mising something, which I can't give to it mous.JPG
     
  10. Deleted User

    Deleted User

    Guest

    Oh, and I am running 2020.2.7f1.
     
  11. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,911
    That error is saying that line 23 in your code is missing a semicolon.

    Look at line 23. Lo and behold there is no semicolon. You need a semicolon at the end of the line.
     
    Deleted User likes this.
  12. Deleted User

    Deleted User

    Guest

    Sometimes, I wonder, at how stupid I am, I'm used to working with compilers that show missing ones to me.
    Anyways, thank you, wouldn't have understood the errormessage