delete this thread

The movment script I was using before, worked just fine … now I get this error

using UnityEngine;

[RequireComponent(typeof(Movement))]
public class Girl : MonoBehaviour
{
private void Awake()
{
spriteRenderer = GetComponent();
collider = GetComponent();
movement = GetComponent();
}

private void Update()
{
if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow))
{
movement.SetDirection(Vector2.up);
}
else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow))
{
movement.SetDirection(Vector2.down);
}
else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
{
movement.SetDirection(Vector2.left);
}
else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow))
{
movement.SetDirection(Vector2.right);
}

}

public void ResetState()
{
enabled = true;
spriteRenderer.enabled = true;
collider.enabled = true;
movement.ResetState();
gameObject.SetActive(true);
}

}

also, I am wondering … by using arrow keys, will this work for android?

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

You failed to post the message, but you don’t have to because:

The complete error message contains everything you need to know to fix the error yourself.

The important parts of the error message are:

  • the description of the error itself (google this; you are NEVER the first one!)
  • the file it occurred in (critical!)
  • the line number and character position (the two numbers in parentheses)
  • also possibly useful is the stack trace (all the lines of text in the lower console window)

Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.

All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.

Remember: NOBODY here memorizes error codes. That’s not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

If your android device has arrow keys, it will likely work.

If not, look up some tutorials on touchscreens. No sense someone here typing it all over for you.

I’ve moved your post to the scripting forum because it doesn’t relate to anything specifically about 2D.

Please edit your post to use code-tag s too, reading code as plain text is hard.

ok
I never wanted to use UNITY what so ever!
I never wanted to learn CODE in any way shape of form!
I am being pressured to finish an app by friday, and im only a fish that can see the tree, i know how to climb it, but dont know how to get from the water to the tree - you get my drift?

im stuck in animator until i get this movement going, i cannot continue and need help

oh by the way, thank you for moving my post to the correct forum

You are attempting to ask a question in the domain of software engineering, and failing to communicate clearly.

Desires and wants and deadlines are irrelevant.

If you are able to successfully communicate, you may be able to obtain a useful answer.

No actually not at all. I’m not sure what any of the above even means.

Perhaps you need guidance in how to communicate with complete strangers about a technical problem?

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

Good luck!

you are absolutely correct
I do not know how to communicate my issue properly.

thank you for taking the time to show me how to put the code in an easy to understand method.

I began this journey at the request of others (Dwayne Johnson is one of them)
the only instruction I have recieved comes purely from YouTube, no classroom, no pals in software engineering, or anyone I can turn to for immediate help.

I have no clue what I am doing, and the code i posted above - worked, before. I was running the character around the gameplay area with no issues. I ran into obstacles that I have no idea how to fix, and restarted the app, this will be the 4th time I restarted, for lack of knowledge.
I am feeling frustrated.
I have no job, no income and am being pressured to finish this app by friday.
I do realize google has the answer, but time to find, read, incorporate the information and fix the issue, will only lead up to the next issue I will have in script writing,
If google has the answer, why does this forum exist.
I am not looking for others to do the work for me, I am simply a man who needs help.

As I stated, my movement script worked before, then I realized I was building an app for computer, and needed to make one for andriod - hence app restart (one of the restarts)
I have come a long way, and this frustration is opening the door for me to just drop this.
after this, I dont believe I will be touching Unity or Code again in my lifetime.

now, can I get some help please, the error tells me the type or namespace name ‘Movement’ could not be found (are you missing a using directive or an assembly reference?)
I have zero clue what that means

@pat_mcguire One note, the error says the error is in girlmovement.cs but the class name is girl (they need to match). You mention it worked before, before what? Do you have a backup from when it worked? You have asked how to help with your code. You will either need to quickly learn how to code by Friday, or hire someone perhaps. Where did you get this code, I assume you didn’t write it from scratch. Why do you need RequireComponent for example? But please begin with the basics on the forum, please post your code with Code Tags as mentioned. It makes it easier for us to read. Perhaps take a few minutes and look at other posts on the forum and see how they format the code with line numbers.

know what i think, i think this is all a big test to see if someone can make an app from YouTube instruction.
so far, i get housekeeping rules, and pointed out the fact that I do not know how to communicate effectively.
know what, it is correct, I do not.
what i find most frustrating is, I am not unintelligent, but making this from nothing, sure makes me feel powerless.
aside from an outside influence, telling me all kinds of things, to force me to NOT make this app, I have a simple app, with very tiny code needed, and have some previous experience way back in grade 7 when i was lucky enough to get a Vic 20.
I do have an understanding, but misspelling a word because of a capital in the wrong place, and the code producing an error message and going through every tiny detail to me is a mind boggling waste.
yes i agree, hire someone to write it, awesome idea … no money
to me it feels like im being setup to fail
with enough time, i can accomplish this code stuff, but time is now short.
I was told to use this forum from M@nx, form halo (wayy back when)
i have used this form for exactly 3 questions, and i say, what i told him, it feels like this forum is for persons who already know what they are doing.
And yes, it is quite obvious i did not write this code on my own, but someone on his youtube channel said it was ok to use any part of his youtube insruction.
now … girl is the mail character … did know what else to call her, and girl and girlmovement didnt come from me, it came from auto title when the script was clicked on to create.
if there are any old halo guys out there
im 5bucks

so to get by this … from google … it says to place MY CLASS in front of girll movement instead of pirvate VOID
private MY CLASS … somehow i dont think this is right

You would be advised to follow the directions here. Perhaps share the YouTube video that shows the correct code, and we may be able to point out where you may have made a mistake. Do you not have a backup? We are not purposely withholding any answers from you, we don’t know either, since we don’t know what you’re trying to do. The best we can do is provide you with troubleshooting steps to hopefully lead you to the correct answer. Is this a test for you? Who is asking you to finish by Friday? Is it Dwayne Johnson? That would be awesome! Also, as I mentioned, the class name and the filename need to match, and could be the cause of your errors.

1 Like

This sounds like perhaps software engineering is not a good career or hobby choice. It’s literally ALL details.

That’s not how youtube code tutorials work. It’s not like spray paint where I can hand you some and you can go spray your car to a different color and go driving happily off.

Unfortunately this misapprehension is common enough that I have standard advice:

Tutorials and example code are great, but keep this in mind to maximize your success and minimize your frustration:

How to do tutorials properly, two (2) simple steps to success:

Tutorials are a GREAT idea. Tutorials should be used this way:

Step 1. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. Even the slightest deviation (even a single character!) generally ends in disaster. That’s how software engineering works. Every step must be taken, every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly, literally NOTHING can be omitted or skipped.

Fortunately this is the easiest part to get right: Be a robot. Don’t make any mistakes.
BE PERFECT IN EVERYTHING YOU DO HERE!!

If you get any errors, learn how to read the error code and fix your error. Google is your friend here. Do NOT continue until you fix your error. Your error will probably be somewhere near the parenthesis numbers (line and character position) in the file. It is almost CERTAINLY your typo causing the error, so look again and fix it.

Step 2. Go back and work through every part of the tutorial again, and this time explain it to your doggie. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. If you are unable to explain any part of it, STOP. DO NOT PROCEED. Now go learn how that part works. Read the documentation on the functions involved. Go back to the tutorial and try to figure out WHY they did that. This is the part that takes a LOT of time when you are new. It might take days or weeks to work through a single 5-minute tutorial. Stick with it. You will learn.

Step 2 is the part everybody seems to miss. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost. If you want to learn, you MUST do Step 2.

Of course, all this presupposes no errors in the tutorial. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. For some other less-well-known content creators, this is less true. Read the comments on the video: did anyone have issues like you did? If there’s an error, you will NEVER be the first guy to find it.

Beyond that, Step 3, 4, 5 and 6 become easy because you already understand!

Finally, when you have errors… go back and see my first response to you, #2 above.

alright, thank you for the insight.
I can tell, my frustration is felt.
I am so close to just quitting, thank you for talking normal to me.
yes, dwayne johnson is involved, known him 2 years now, he is not taking steroids, he is all natural.
he can easily hire a code person, but is one of the persons pushing for it to come out of me.
I see it like this: everyone wants to build their own home. not all persons are carpenters, i have built 26 houses in my time, i know a lot of tips and tricks to get by to make a great build … i am not a software engineer … i do not know all the tips and tricks to get by. all the easy hang ups are a huge deal to me, simply because i cant see my shadow, even though its right in front of my face. it took me 4 months to learn when creating a background image, to check the z axis, and move it backward 1 or 2 … easy peasy huh. MONTHS to learn that.
right now i have the main menu DOWN, the credits scene DOWN, levels 1, 2, and 3 DONE
I have begun animations, i have all animations done, but not DOWN yet, i still need to learn parameters, and then incorporating into script - YAY - looking forward to that (sarcasm there)
I have my sounds and sound bites ready to go, but not installed, then i have to write up the sound manager, game manager, movement, enemy, firing arrows scripts … all scripts are last … I have my button scripts DOWN
me, about to enter the dragon …
I really could use the help, believe you me, i will return the favour any way i can, and i most definitely will pay it forward.
I am going to take a break now, and I will let this post know what avenue I have taken …

I was using the YouTube video … How to make Pacman in Unity, by Zigurous
I am also using his pellets script, so far i am not tackling scripts because the game manager is referred too, and i get errors i cant get by unless that game manager is complete
that is the reason im holding all scripting until the end … which will be tomorrow, and run out of time on friday :frowning:

actually, there are a great many YouTube vids I gained knowledge from, and have them all written down in order to thank them all

You forgot the most important parts! To answer the questions. Do you have a link to the video? Do you have a backup? Do you understand the comment about filename and class name? If not, please ask very specific questions, and take it one step at a time. Learning C# is much like learning French (or any other language) and is VERY detailed. One wrong spelling and the entire code won’t work. So you just watched a video on how to write a book in French. It would be nearly impossible for you to then go write your own book in French if you don’t know the language. Same with C# and Unity.

link …

im sorry no, i failed to keep backups, i got angry and HULK (wannabe) SMASH … deleted …

yes i understand the comment about filename and class, thank you.
gonna be up late the next 3 days for sure

Before we watch a 3 hour video, can you point to the time in the video where it refers to the RequireComponent syntax? I might assume that the required component is described just before that.

my apologies for the delay, I am a single parent, juggling everything takes a bit of time.
the pacman script begins at 1:21:32 … but Zigurous likes to jump around quite fast and switch scripts quickly
it is also available here:

I dont know what time zone your in, to be at almost 1am but here its almost 9pm, and im getting my girly ready for bed
ill be on, posting … you are welcome to come check my posts

@pat_mcguire I downloaded the zip file from Github, and it works great! So your script is called girl.cs? I trust that you got the game working with no changes first, right?

Ok, I went through all the animations and have them all working correctly, I just need parameters, then script incorporation… I haven’t gotten back to the girl script yet, but your response gives me hope, I’ll be on it after I get my brood off to school in the AM, have a good sleep

You might consider downloading the full project zip file, decompressing and then opening the project in Unity https://github.com/zigurous/unity-pacman-tutorial/archive/refs/heads/main.zip

7900363--1006420--PacMan.png