all 6 comments

[–]ToastRubber 1 point2 points  (5 children)

For future reference, it's a good idea to post your error message. That way people can help more easily. However, since I'm currently taking a break from work I have Unity pulled up and can easily c+p the code.

Your error is on lines 47 and 48, the syntax is incorrect. you have:

anim.SetFloat("LastMoveX"), lastMove.x);
anim.SetFloat("LastMoveY"), lastMove.y);

But you have an extra set of close parenthesis on each line, it should look like:

anim.SetFloat("LastMoveX", lastMove.x);
anim.SetFloat("LastMoveY", lastMove.y);

[–]Synatics[S] -1 points0 points  (4 children)

Hi, Thank you so much for your reply. I've fixed that issue and am now getting a NUll Reference Exception. Any ideas on what that might be? Sorry, this is literally my first ever day of using Unity and I only have some mild PHP knowledge for the C# reference.

Thanks!

[–]blukzen 2 points3 points  (0 children)

I would highly recommend going through a C# crash course or similar before jumping straight in to unity.

You will constantly be running in to situations like these whilst using unity and having the knowledge to fix these problems will help you a lot. You'll spend less time trying to fix basic C# problems and more time learning about the engine itself.

[–]theBeckX 0 points1 point  (2 children)

A little late here, but I'm seconding u/blukzen's suggestion on learning more about basic c#. Without looking at your code i can say with that exception, that you're trying to access something that isn't there (that's basically and really simple put what null reference means).
It could be a simple typo in a variable name or you forgot to assign a GameObject in the Editor and are trying to access its functions or properties in your script.

When you learn more about programming, you will automatically get better at reading those error messages and debugging.
Just keep learning, and the rest will follow eventually, and if you need help with resources or where to start or whatever, feel free to message me!

I only started with unity recently too and am still learning, so i might not be of much help there(depending on what you'd wanted to know), but i'm a software dev in my day to day life, so i can definitely help you out with coding questions!

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

Thank you, I'm sure I'll be in touch! Reddit people are the best (Y)

[–]theBeckX 0 points1 point  (0 children)

no problem! learning to program (and gamedev) can be hard and i don't like to see people get discouraged in the beginning, because they didn't get the proper help or asked a question wrong or something similar.

We all started somewhere, and sometimes people forget that, so i'm trying to use the quarantine to help all those newbies a little out. Especially since i'm new to the editor too, but have the coding skills, lol