Search Unity

Question Error 0103 in my code (help for fix)

Discussion in 'Code Editors & IDEs' started by acoder433, Feb 2, 2023.

  1. acoder433

    acoder433

    Joined:
    Jan 21, 2023
    Posts:
    3
    hi so i have the error 0103 which says there is a missing } can anybody help me


    here is my code:


    using UnityEngine;

    [RequireComponent(typeof(PlayerMotor))]
    public class PlayerController : MonoBehaviour {

    [SerializeField]
    private float speed = 5f;
    [SerializeField]
    private float lookSensitivity = 3f;

    void Start ()
    {
    motor = GetComponent<PlayerMotor>();
    }

    void Update ()
    {


    //Calculate movement velocity as a 3D vector
    float _xMov = Input.GetAxis("Horizontal");
    float _zMov = Input.GetAxis("Vertical");

    Vector3 _movHorizontal = transform.right * _xMov;
    Vector3 _movVertical = transform.forward * _zMov;

    // Final movement vector
    Vector3 _velocity = (_movHorizontal + _movVertical).normalized * speed;

    //Apply movement
    motor.Move(_velocity);

    //Calculate rotation as a 3D vector (turning around)
    float _yRot = Input.GetAxisRaw("Mouse X");

    Vector3 _rotation = new Vector3(0f, _yRot, 0f) * lookSensitivity;

    //Apply rotation
    motor.Rotate(_rotation);

    //Calculate camera rotation as a 3D vector (turning around)
    float _xRot = Input.GetAxisRaw("Mouse Y");

    float _cameraRotation = _xRot * lookSensitivity;

    //Apply camera rotation
    motor.RotateCamera(_cameraRotation);
    }

    }
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,491
    I've moved your post to the scripting forum for you. Also, please edit your post to use code-tags when posting code.

    Error codes are meaningless here. The error code reports both the line/column numbers and a description which you should also post.

    The compiler is telling you it's expecting a closing brace so look at the braces and ensure that each opening brace has a respective closing brace.

    Thanks.
     
  3. acoder433

    acoder433

    Joined:
    Jan 21, 2023
    Posts:
    3
    okay thank you can you check where i need it in my code if you can