I am almost done rewriting my JavaScript Traffic AI in C#. However I bumped into this problem and I can’t see no reson why this should be wrong. In Javascript I use this line to access a script that is attached to the waypoint container object:

 var PathScript: PathScript = waypointContainer.GetComponent(PathScript);

Now in C# I’v written:

 PathScript PathScript = waypointContainer.GetComponent<PathScript>();

But then I get:
“The type or namespace name `PathScript’ could not be found. Are you missing a using directive or an assembly reference?”

I have used the exact same code in other CS scripts without any problems…

like this (where “AxisCarController” is a script) :

   AxisCarController AxisCarController = Car.GetComponent<AxisCarController>();
              AxisCarController.active=false;

What’s the difference here?

It’s order of compilation - PathScript would have to be in Plugins/Standard Assets etc to be accessible from C#. When translating piecemeal it’s a good idea to move all of the JS to folders under Plugins to stop this kind of problem.