Complete noob when it comes to Unity. Learning off of youtube videos (really just copying code directly) and am doing this for a school assignment. Facing an Error CS0246 which is completely messing me up which keeps telling me I am missing a using directive or assembly reference in my line when I don’t think I am as it worked every other time and for the dude in the video. If any could possibly identify the problem, thank you!
Need help ASAP, Screenshot attached.
A: Post the whole error.
B: Post the whole script as text in a post (correctly formatted), and not a screenshot.
Possibly, it conflicts with InputManager somehow.
Try to rename your class.
Then you’re just wasting your time. There’s only two steps you have to do actually learn:
Two steps to tutorials and / or example code:
- do them perfectly, to the letter (zero typos, including punctuation and capitalization)
- stop and understand each step to understand what is going on.
If you go past anything that you don’t understand, then you’re just mimicking what you saw without actually learning, essentially wasting your own time. It’s only two steps. Don’t skip either step.
You can fix your own typing mistakes. Here’s how:
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.
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.
Look in the documentation. Every API you attempt to use is probably documented somewhere. Are you using it correctly? Are you spelling it correctly? Are you structuring the syntax correctly? Look for examples!
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.