Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just updated Unity to 5.4 today, though as I saw, this problem was present in previous versions too.
So the error message is : "The type or namespace name 'FirstPersonController' could not be found (are you missing a using directive or an assembly reference?)

This happens when I try to reference the FPSController prefab's FirstPersonController.cs (obviously I'm talking about the one from StandardAssets/Characters).

Yes, I did try including "using UnityStandardAssets.Characters.FirstPerson" in my script, but no, it did not work. Doesn't even recognize is as a valid namespace.
The same happens when I try the other way: when I try referening my script inside the FirstPersonController.cs. It just doesn't recognize it as valid.

Anybody has any idea how to solve it?

share|improve this question
    
Is the file name the same name as the class? – SuperSquareBoy Sep 12 at 22:19
    
Yes. Anyway, weeks later, now it's working. I have no idea how or why, but now it recognizes the UnityStandardAssets namespace and the others as well. So now I can just use FirstPersonController and a static variable I made inside it and modify it so it works just like I wanted. Weird though – spartai Sep 25 at 18:18

It sounds like you have a conflict between the versions of unity the project is referencing.

Are you using VS to edit your scripts? If so, expand the references node in the solution explorer and see if you have any missing/broken references.

share|improve this answer

I had an identical issue with the AeroplaneController script.

While I do not acknowledge it as the absolute solution, I solved the issue by actually moving the script to my local scripts folder.

The problem appears to be in having native access to scripts across a folder hierarchy. If script A is in a different parent folder to script B, neither will have the ability to immediately reference each other.

Ofcourse, this added some other problems. In my case, AeroplaneController referenced one or two scripts (or was referenced by, I honestly can not remember for sure), and moving it outside of the folder structure removed the ability to see the other scripts / AeroplaneController from the other scripts. I would have either moved the important scripts, as well, or removed the reference to AeroplaneController in the unimportant scripts simply to remove the error.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.