RickP
May 4, 2010, 4:04pm
1
Can we not mix the 2? The pathfinding library I’m using is in C#. It has a class named AIFollow. My scripts are in javascript, but when I try to make a variable of AIFollow I get "The name ‘AIFollow’ does not denote a valid type.
How can I hand this?
This has to do with the compile order. I think you might get it if you put the C# scripts in the Standard Assets folder.
Read this to get the full overview of the compile order:
RickP
May 4, 2010, 5:58pm
3
Very cool. That seemed to work. Thanks!
I’m also having difficulty accessing c# from within Javascript.
This is in a Javascript attached to the gameObject
script = GetComponent(CubeRoller);
script.whichway ();
CubeRoller is the c# script
whichway() is the function in the c# script
the c# script is attached to the game object
but i get the message CubeRoller is an unknown identifier?
if the c# needs to be in the Standard Assets Folder, where should the Javascripts be put?
as stated in the documention.
“All scripts that are compiled in this step have access to all scripts in the first group (“Standard Assets”, “Pro Standard Assets” or “Plugins”)”
So that’ means you’ probably want your javascript file in the root folder of the project.
Ah Ha!!!
theres another way
// Calls the function ApplyDamage with a value of 5
gameObject.SendMessage (“ApplyDamage”, 5);
// Every script attached to the game object
// that has an ApplyDamage function will be called.
function ApplyDamage (damage) {
print (damage);
}
this was also in the manual, and this time it works!!! :))