Search Unity

hi i am Programming with c#. I have an errorand i don´t know how to fix it. Please help !

Discussion in 'Scripting' started by Martin202121, Apr 13, 2021.

  1. Martin202121

    Martin202121

    Joined:
    Apr 13, 2021
    Posts:
    2
    here is the error:
    Assets\PlayerMovment.cs(12,5): error CS0246: The type or namespace name 'Vectore3' could not be found (are you missing a using directive or an assembly reference?)
    here is the code:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class PlayerMovment : MonoBehaviour
    {
    public CharacterController controller;
    public float speed = 12f;
    public float gravity = -9.81;
    Vectore3 velocity;
    // Update is called once per frame
    void Update()
    {
    float x = Input.GetAxis("Horizontal");
    float z = Input.GetAxis("Vertical");
    Vector3 move = transform.right * x + transform.forward * z;
    controller.Move(move * speed * Time.deltaTime);
    velocity.y += gravity * Time.deltaTime;
    controller.Move(velocity * Time.deltaTime);
    }
    }
     
  2. BenniKo

    BenniKo

    Joined:
    Mar 24, 2015
    Posts:
    100
    The error-message tells you what you need to change:
    You wrote "Vectore3" but it needs to be "Vector3".

    Also: Please use code tags :)
     
    Joe-Censored likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    The code example, wherever you got it from above, is broken. It will fail to jump sometimes.

    I wrote about this before: the Unity example code in the API no longer jumps reliably. I have reported it. Here is a work-around:

    https://forum.unity.com/threads/how...racter-movement-in-unity.981939/#post-6379746

    Keep in mind if you want to type in random bits of code like this, 100% of spelling, capitalization, punctuation and spacing must be absolutely precisely correct, otherwise it will not work at all.

    ALSO, as BenniKo points out, if you post a code snippet, ALWAYS USE CODE TAGS:

    How to use code tags: https://forum.unity.com/threads/using-code-tags-properly.143875/

    Finally, how to understand compiler and other errors and even fix them yourself:

    https://forum.unity.com/threads/ass...3-syntax-error-expected.1039702/#post-6730855
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    On helping yourself use error messages, the numbers in parentheses (12,5) mean line 12 column 5. The line number is the important part. Combine that with the text of the error, and it is usually immediately obvious.
     
    Last edited: Apr 13, 2021