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
2020 May 26; 12 1758835920925991 <a href=https://fastpriligy.top/>priligy farmacias del ahorro</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

58 comments

105k users

...