import namespace navigation

Howdy folks, I’m a Unity newb doing some scripting and running into somewhat of a blocker… I know the quick and dirty solution is to put all the scripts all in the same directory, but how does one script access another from a different folder?

For example
If I’ve a BotPart class defined in /BotPart.js

Weld.js In project root directory: /Weld.js
import BotPart; works as expected

PlayerMovement.js In project folder subdirectory: /Scripts/Movement Scripts/PlayerMovement.js
import BotPart; generates an error “Namespace ‘BotPart’ not found, maybe you forgot to add an assembly reference”

What sort of import statement would it take for PlayerMovement.js to import BotPart?

Thanks in advance for the help.

Where a script is located makes no difference; nothing needs to be done, since folders are for project organization only and aren’t part of script classes. The only exception is when mixing C# and JS scripts, in which case you need to use one of the “special” folders to make sure scripts compile in the right order. (See here.) I replicated your setup and didn’t get any errors when using “import BotPart”.

–Eric

Thanks for the compilation details link! As it turns out, the second class “PlayerMovement” was being compiled before any of the others because it was in a subfolder to the Standard Assets folder. Moving all scripts into different organizational subfolders of the Standard Assets folder did the trick.

Again, thanks so much for the help to getting that solved.