S
S
snow8823135782020-05-23 17:12:03
C++ / C#
snow882313578, 2020-05-23 17:12:03

How to write a script to move a 2d character?

Hello everyone, don’t judge strictly, I’ve been trying to write a script for character movement,
I just started making games not long ago and I can’t write a C # script in Unity. It knocks out errors, although I wrote everything normally, even rewrote it a bunch of times, I think you can help, I tried to make control A and D and SPACE and that's it, but it doesn't work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2020-05-23
@snow882313578

In Google translate, you can translate the text of the error and understand that your code uses the MovementSpeed ​​variable, which you did not set anywhere, that is, the program does not know what this variable is and what its value is. This is what your code is complaining about.

S
snow882313578, 2020-05-23
@snow882313578

I made a mistake in the variables and the variable didn't work
public float MivementSpeed ​​= 1;
public float JumpForce = 1f;
Corrected It is necessary Movement and not Mivement such a small mistake and I sat on it for 3 hours thanks a lot again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question