I was wondering if you could access a cs script from a javascript and vice versa, I tried this…
script = someObject.GetComponent(someCsScript);
this gave me compiler errors, the errors went away when I tried accesing a javascript instead like this…
script = someObject.GetComponent(someJavaScript);
So can you access a cs script from within a java script file? if so how do you do it?
Also I noticed the cs scripts don’t have the enabled checkbox in the inspector, why is this?
As always thanks for all the help.
See the scripting documentation on compilation order. The javascript you want to access from C# (or vice versa) has to be compiled before the script you are using it from.
Re. the enabled flag. All script inheriting from MonoBehaviour should have a enabled flag. Did you ensure that your C# script inherits from MonoBehaviour? Also check if all scripts compiled without errors.
Isn’t it the case that the enabled checkbox now only appears if you implement one of the event methods that it affects, such as Start or Update? I think that was one of the changes made for 2.0.
Thanks for que quick feedback guys, I overlooked that part in the documents.