F
F
fanot2017-09-10 19:04:27
C++ / C#
fanot, 2017-09-10 19:04:27

Error CS1061. What's wrong?

Hey! In the last unit I inserted a script to create a platformer. The script was taken from an old video. I corrected 2 errors with the help of this site, the last one remained: 403b75ba0bb644828a8b0cd698abf208.png
Help! I can send more screenshots.
(if anything, a link to a video about the creation of this platformer: https://www.youtube.com/watch?v=oYaGPeZW8JM

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniil Basmanov, 2017-09-11
@fanot

This line changes the horizontal speed, so you need to change rigidbody2D to rb and take the current vertical speed:

rb.velocity = new Vector2(move*maxSpeed, rb.velocity.y);

P
Pparma, 2017-09-10
@Pparma

In the same place in the comments to this video:
"in version 5 of Unity in the script you need to write not rigidbody2D but GetComponent.()"
True, it's not very good to use GetComponent on every update.
If possible, it is better to do this at the start of the script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question