I have C# scripts in my Unity project. I want to use it in my JS script. But I can't make any reference to a class in the C# script.
How to do that?
I have C# scripts in my Unity project. I want to use it in my JS script. But I can't make any reference to a class in the C# script.
How to do that?
The problem here is that at compile time different compilers are used for the different languages. So they have no knowledge of each other's existence. There is a way around it by considering the steps in which Unity compiles code.
Code in a folder named Plugins for example (as well as Standard Assets" and "Pro Standard Assets") is compiled before code in regular folders. So if you want to call your C# code using UnityScript, put your C# code in a folder name Plugins within your assets.
If you then keep your UnityScript code in a regular folder, once it will be compiled the C# code should already be compiled and available.