- Home /
Accessing other scripts in C# with Visual Studio.
I have only used unityScript up until now, but now I have to change to C# so I'm not that good at it. This might be super basic. Here is a example taken from unity's website. It's an example on how to access other gameobjects via script, and it's in C#. As you see they set the variable type of the other script with the name of the script, "OtherScript". When I try to do this Visual Studio says that it does not recognize the usage. Is this a old method of writing type of scripts?
Answer by LeonardNS · Sep 13, 2015 at 08:04 AM
All the scripts have to be C# for Visual Studio to work correctly.
That's not true. You can use both together. You only have to make sure that the UnityScripts are compiled before the C# script that makes use of them. That is, you have to put them into the Standard Assets folder (or any subfolder) or the Plugins folder (or subfolder). And the other way 'round if you want to use a C# script with in a UnityScript.
But Visual Studio will fuck you over. It can't use UnityScript. Of course if you do not use Visual Studio it'll work, but with it you'll get an error message and you can't do anything about it. It has the solution but it can't read UnityScript so it won't understand what you mean when you write "OtherScript".
Your answer
Follow this Question
Related Questions
Impossible to use Visual Studio 2015 Debugger anymore (Unity 5.2.1f) 2 Answers
csc.exe has stopped working ,csc.exe has stoped working 0 Answers
vector 3 isnt working offset part,the vector 3 isnt working 'offset' has a problem 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers