Namespaces, referencing those namespaces, and everything in between.
I am currently using the Unity standard assets character controller, but I wanted to add in fall damage. I added my health script to the namespace UnityStandardAssets.Characters.FirstPerson, and everything worked fine. Then my game kept on building up from that, and eventually I had scripts completely unrelated to the character, in the same namespace mentioned above. This was an issue, so I decided, "Huh, Unity supports namespaces, let's do this!" and I made a couple (2) namespaces, player and enemy respectively. So then, I added my health script to this namespace. Bang, 20 different errors. So, I go into the FirstPersonController script, and add this to the very top:
using player;
And that eliminates 19 of the errors. Actually, all 20. But it gives me a new one. "The type or namespace health could not be found, are you missing a using directive or an assembly reference?"
The code that the problem comes from is this:
p_health = GetComponent<health>();
Of course, I have added all the variables needed for this. This issue does not occur in my enemy script, where I can reference player without a problem. Would it be an issue with the order of my references? I have tried mimicking the order of the enemy scripts, and nothing changes.
Any help is much appreciated, as it has put my team's development completely on hold.
have you checked if health is in a namespace and you also added the using directive too?