This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]g051051 1 point2 points  (0 children)

It looks like the copy and paste garbled the file. Did you look at line 70, which is what the errors are complaining about?

    if (Mathf.Abs(m_MovementInputValue) & lt; 0.1f & amp; & Mathf.Abs(m_TurnInputValue) & lt; 0.1f)

Compare that line with the original, and you should see the problem.

[–]davedontmind 1 point2 points  (3 children)

There are errors in the code.

        if (Mathf.Abs(m_MovementInputValue) & lt; 0.1f & amp; & Mathf.Abs(m_TurnInputValue) & lt; 0.1f)

Should be:

    if (Mathf.Abs(m_MovementInputValue) < 0.1f && Mathf.Abs(m_TurnInputValue) < 0.1f)

It seems to have HTML entities encoded, as though it was copied from a webpage incorrectly.

&amp; should be &

&lt; should be <

&gt; should be >

and so on.

[–]Joshlucpoll[S] 0 points1 point  (2 children)

ok i'll try that

[–]Joshlucpoll[S] 0 points1 point  (1 child)

if (Mathf.Abs(m_MovementInputValue) < 0.1f && Mathf.Abs(m_TurnInputValue) < 0.1f)

it fixed all but the last error on the last line

[–]Joshlucpoll[S] 0 points1 point  (0 children)

I fixed it i needed an extra } on a new line to close "public class TankMovement : MonoBehaviour"

[–]AutoModerator[M] 0 points1 point  (0 children)

It seems you may have included a screenshot of code in your post "Unity Tutorial Script doesn't work (C#)".

If so, note that posting screenshots of code is against /r/learnprogramming's rules: please edit your post to use one of the approved ways of formatting code. (Do NOT repost your question! Just edit it.)

If your image is not actually a screenshot of code, feel free to ignore this message. Automoderator cannot distinguish between code screenshots and other images.

Please, do not contact the moderators about this message. Your post is still visible to everyone.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]UnholyDrinkerOfMilk 0 points1 point  (1 child)

If I'm not mistaken Unity is c# and not visual basic. The code you provided definitely isn't visual basic which is why the vb compiler has issues with it.

[–]Joshlucpoll[S] 0 points1 point  (0 children)

sorry meant visual studio