Issue adding script as component

Hi all,

I am an amateur Unity User. Im encountering an issue where I try to add a component to any of my objects, there are no scripts available for me to use. I have uploaded everything to the Assets folder and added copies into Assets/Scripts so that either way they should work.
For reference I am following this tutorial to create a simple FPS player: https://www.youtube.com/watch?v=f473C43s8nE

I then try to create a new script all together, to which I copy and paste the code from the other files. It still doesnt work. All scripts say they are private (which I dont know why, the class and variables below are public) and “No monobehavior scripts in the file…”
I am using this for a class project, so I really need help ASAP. Let me know what else to try.

What do you mean by that? What says it’s private?

I have uploaded everything to the Assets folder and added copies into Assets/Scripts so that either way they should work.

If you have multiple copies of your scripts, that is definitely going to cause an error, which is not going to let your code compile and therefore not let you attach scripts to anything.

Have you looked at your console window to make sure you don’t have any compile errors? I bet you have several.

2 Likes

I just realized this “private” might be regarding Unity Version Control thing I am using to work with my partners (which I am also struggling to figure out lol).

I just deleted the copies and originals of every script. I created completely new files and put them in the Assets/Scripts folder. There are no compiler errors for these scripts in the console. There are a bunch of other errors for other files, but that shouldn’t interfere right? Ive billionth time checked to make sure the file names and class names match as well.

Any compiler error prevents all hooking up and function.

Software has to be 100% or it’s nothing.

Two steps to tutorials and / or example code:

  1. do them perfectly, to the letter (zero typos, including punctuation and capitalization)
  2. 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.

If you just need an FPS script, that’s easy, start with this one:

That one has run, walk, jump, slide, crouch… it’s crazy-nutty!!

2 Likes

Wrong. You must fix all your compiler errors before continuing.

3 Likes

This is awesome. Thank you so much. All figured out now!

2 Likes