- Home /
How do I use scripts in different directories?
I have classA that uses classB but classB is in another directory:
\Scripts\classA.cs \Scripts\navigation\classB.cs
Is it possible to use relative paths in C# AND javascript to access scripts in other folders? I'd like to clean up my Scripts directory by categorizing my scripts. Thanks!
Thanks!
Answer by Daniel-Brauer · Aug 26, 2010 at 06:34 PM
Short answer: Put scripts anywhere you like, and everything will just work.
Long answer: Scripts only reference one another by class name. The location and file name don't matter, with the following exceptions:
- The file name has to match that of the first class in the script. For Javascript files with no explicit class, the class name is derived from the script name.
- Scripts in certain folders will be compiled sooner or later than other scripts. Full details are available on this page of the manual.
Answer by emicenizo · Jan 18, 2021 at 09:19 AM
FYI: If you MOVE a script in a different folder it will work on code, but the references that you had to that script on the Editor will be lost (you just have to add them again). Be careful cause it's annoying.