0 votes
by (8.2k points)

There are errors related to the name.

[21:31:18] Assets\scripts\playerControler.cs(16,28): error CS0103: The name 'input' does not exist in the current context

[21:31:18] Assets\scripts\playerControler.cs(16,56): error CS0103: The name 'movementSpeed' does not exist in the current context

[21:31:18] Assets\scripts\playerControler.cs(17,26): error CS0103: The name 'input' does not exist in the current context

[21:31:18] Assets\scripts\playerControler.cs(17,52): error CS0103: The name 'movementSpeed' does not exist in the current context

Assets\scripts\playerControler.cs(16,28): error CS0103: The name 'input' does not exist in the current context

public class playerControler : MonoBehaviour

Charactercontroller characterController;

public float movmentspeed = 5;

// Start is called before the first frame update

void Start()

charactercontroller = GetComponent<Charactercontroller>();

// Update is called once per frame

void Update()

{

float horizontal= input.GetAxis("Horizontal") *movementSpeed; float vertical = input.GetAxis("Vertical") *movementSpeed;

charactercontroller.Move (transform.forward* vertical + transform.right* horizontal);

}

by
Наставник сказал: «Когда Государь не великодушен, при исполнении церемоний невнимателен, впавши в траур, не печален, — как ему быть примером?»  <a href="https://meri-vinchester.citatyi.ru">https://meri-vinchester.citatyi.ru</a>
by
Уравнение умнее своих создателей.  <a href="https://gory.citaty-tsitaty.ru">https://gory.citaty-tsitaty.ru</a>
by
Боль иногда уходит, но мысли то остаются. (к/ф Неприкасаемые)  <a href="https://muzyka.citaty-tsitaty.ru">https://muzyka.citaty-tsitaty.ru</a>
ago by
Исследование субъективного опыта поля и духа.  <a href="https://model-korotkova.robert-dilts.ru">Пирамида логических уровней 2.0 Короткова. </a>
ago by
Утверждения, описывающие разные уровни реакции на события. Медленно поднесите руки к телу, ощущая полноту и широту в поле. Линии времени помогают упорядочить события.  <a href="https://sinergiya.robert-dilts.ru">[Пирамида Короткова -  </a>

1 Answer

0 votes
by (8.2k points)

All these errors,  I can say that these errors are occurring as you are not using UPPER CASE and LOWER CASE alphabets of all your variables.

void Update()

    {

        // player movement - forward, backward, left, right

        float horizontal = Input.GetAxis("Horizontal") * MovementSpeed;

        float vertical = Input.GetAxis("Vertical") * MovementSpeed;

        characterController.Move((transform.right * horizontal + transform.forward * vertical) * Time.deltaTime);

        // Gravity

        if (characterController.isGrounded)

        {

            velocity = 0;

        }

        else

        {

            velocity -= Gravity * Time.deltaTime;

            characterController.Move(new Vector3(0, velocity, 0));

        }

    }


     float horizontal = Input.GetAxis("Horizontal") * MovementSpeed;

        float vertical = Input.GetAxis("Vertical") * MovementSpeed;


Kindly Correct both the lines.

TechXR runs courses in AR / VR / Metaverse / Game Development. Some of the popular Q&A in our courses are available here for easy discovery.

113 questions

117 answers

266 comments

127k users

...