Is this some sick joke? The type or namespace name `FirstPersonController' could not be found

So basically what happened is. I wanted to start working on the environment of my game so i downloaded and imported easy roads from the asset store. It did not load i cant see and of the menu options that are displayed in youtube videos that i have found. I figured maybe i should restart unity and see if something had to be initiated when it first loads up. Easy roads still didnt load any menu options. and suprise suprise i get this error. I did not touch or even look at the files listed below. Nor did i see anything to do with the first person controller or the standard assets when i imported easy roads. now im getting these 8 errors. WHY!!

Im really starting to see why other devs knock unity. im trying really hard not to hate it at this point.

Assets/Scripts/Generic/NetworkPlayer.cs(17,17): error CS0246: The type or namespace name FirstPersonController' could not be found. Are you missing UnityStandardAssets.Characters.FirstPerson’ using directive?

Assets/Scripts/Generic/NetworkPlayer.cs(17,43): error CS1061: Type T' does not contain a definition for enabled’ and no extension method enabled' of type T’ could be found. Are you missing an assembly reference?

Assets/Scripts/Generic/PlayerVitals.cs(276,52): error CS1061: Type UnityStandardAssets.Characters.FirstPerson.FirstPersonController' does not contain a definition for m_WalkSpeed’ and no extension method m_WalkSpeed' of type UnityStandardAssets.Characters.FirstPerson.FirstPersonController’ could be found. Are you missing an assembly reference?

Assets/Scripts/Generic/PlayerVitals.cs(276,21): error CS1061: Type UnityStandardAssets.Characters.FirstPerson.FirstPersonController' does not contain a definition for m_WalkSpeed’ and no extension method m_WalkSpeed' of type UnityStandardAssets.Characters.FirstPerson.FirstPersonController’ could be found. Are you missing an assembly reference?

Assets/Scripts/Generic/PlayerVitals.cs(281,51): error CS1061: Type UnityStandardAssets.Characters.FirstPerson.FirstPersonController' does not contain a definition for m_RunSpeedNorm’ and no extension method m_RunSpeedNorm' of type UnityStandardAssets.Characters.FirstPerson.FirstPersonController’ could be found. Are you missing an assembly reference?

Assets/Scripts/Generic/PlayerVitals.cs(281,21): error CS1061: Type UnityStandardAssets.Characters.FirstPerson.FirstPersonController' does not contain a definition for m_RunSpeed’ and no extension method m_RunSpeed' of type UnityStandardAssets.Characters.FirstPerson.FirstPersonController’ could be found. Are you missing an assembly reference?

Assets/Scripts/Networks/ServerNetworkCharacter.cs(27,17): error CS0246: The type or namespace name FirstPersonController' could not be found. Are you missing UnityStandardAssets.Characters.FirstPerson’ using directive?

Assets/Scripts/Networks/ServerNetworkCharacter.cs(27,43): error CS1061: Type T' does not contain a definition for enabled’ and no extension method enabled' of type T’ could be found. Are you missing an assembly reference?

Looks like you’re missing some scripts :slight_smile:
Are all of those scripts from EasyRoads? I don’t use that, so I don’t know…

No… I wrote those scripts they have nothing to do with easy roads. thats why im so confused. i have a feeling i ran into some random bug that cant find the first person controller. im trying to reimport the standard assets package right now. but im sure it is going to open a can of worms when its done.

FirstPersonController is part of UnityStandardAssets. If you installed them with Unity, you can find them under
Assets->import package → character.

Okay, so after you re-import it, try adding the namespace to one of your scripts and see if that helps :slight_smile:

If you have more issues, perhaps post the code ?

yes the standard assets have been import months ago when I first started my game. my question is why am i getting these errors if easy roads has nothing to do with them or even reference them for that matter?

Not sure how those 2 would possibly be connected, sorry.

1 Like

thanks for the input anyways…

When in doubt, exit Unity, delete your project’s library folder, and reopen the project. This will cause everything to get reimported/recompiled. If you’re still getting the errors afterward then you’re actually missing something instead of having a corruption in the library folder :smile:

Happened to me once

1 Like

attempting now. and have a bad feeling.:face_with_spiral_eyes::hushed::frowning:

welp there goes 3 months down the drain. still getting errors plus a few more. Now Inventory Master isn’t even showing up and i didn’t know that literally all of the prefabs in my project would loose their attached scripts and all the information they hold. needless to say im extremely frustrated. sigh. woo hooo now i get to spend the next year learning UE from scratch… this blows. fml

what hurts most is i made a ton of progress this month getting all of these scripts and prefabs together to get to a point where things are actually working and its all gone to shit. and lets just say this was my 3rd attempt in 2 years to make a game with unity and they all failed due to some foolishness like this.

Hm, that sucks… sorry to hear that.

Hopefully you can fix one thing a time and get it working, again, soon.

The information on your prefabs and attached scripts shouldn’t be lost. It just isn’t necessarily filled in until you have resolved all script errors.

I hope you sort it out. This would also be an awesome time to look into source control. There are plenty of tutorials. We use git and a lot of other developers use it too.

If you choose not to use source control (which would completely eliminate this sort of problem when used correctly), you should at a bare minumum periodically make a full zip backup of your project and move it to another hard drive for safekeeping.

Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It’s just not worth not backing up.

1 Like

ya i know… I did purchase a WD personal cloud last time my computer crashed and I recently moved and go figure i didnt get around to hooking it back up. :slight_smile:

lets just say i had pretty much all of the items working which could be picked up and added to the player inventory along with details of each item tailored to inventory master. consumables could be used. the player shooting mechanics almost completed. network connections made to photon network for private instances of the game for groups or “squads”. animations have been synced across the network.

and now everything i click on has something not assigned in its prefab. Im going to have to be very bored one day if i ever decide to attempt to fix this…

just one of the player characters but there is 6 in total
https://ibb.co/c9HsoG

pickupable item example and there is over 35 items to fix.
https://ibb.co/kCr5aw

then dont even get me started on adding all the item information to the backend of inventory master… smh

Anyways thanks again to everyone for the help…

Try fixing one of the script’s compilation errors and then looking at a game object that has one of those missing/invalid scripts on it :slight_smile:

2 Likes

ok im a bit more calm. I got it down to 4 errors. :confused: I still dont understand what caused this tho.

That’s good. Did you happen to eliminate all errors from 1 or more scripts … and did that fix your attached scripts (issue), if so? :slight_smile:

Good luck with the last 4… I’m sure you’ll get it sorted.

The solution file might be corrupted (its not inside the library folder but your project folder). Happens sometimes when multiple sources try to update the codebase at the same time, the codebase itself gets updated from all the sources, but only one source manages to reflect its changes on the solution file. Then what happens is that Unity thinks the solution is up to date when its not so it doesn’t have access to all the code as it should.

Close Unity and any app you’re using to edit your code, then navigate to your project’s folder and delete the .sln file. If you’re paranoid you can also delete the .csproj files, it may be that the files are missing an include compile tag (just realize that these files are also how your IDE tracks which files you were editing when you closed).

Then reopen Unity. Unity will detect that the project is missing a solution file (and any .csprog files) and will generate a new one that should be properly up-to-date. Unity should be able to regenerate these files without the need restarting, but I always restart just to be thorough.

1 Like

I ran into the same issue a couple minutes ago haha…
Here’s the solution for me:
FirstPersonController script and StarterAssetsInputs script etc fall into the StarterAssets namespace.
suppose your class is named HelloScript.
In order to use said scripts in HelloScript you should import StarterAssets in your HelloScript by writing in the top :

using StarterAssets;

this should solve “The type or namespace name `FirstPersonController’ could not be found”.

2 Likes