So I would like to enable and disable the RichAi component(or at least stop it from path finding). I think I have to call the OnDisable function in richAi. Just wondering how to do this from Js? or if there is a better way, if any. Thanks
You should not call the OnDisable function directly since it is a method unity calls (http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnDisable.html).
Instead you should use the “enabled” property.
myRichAIComponent.enabled = false;
from the same gameobject i have been trying to use -
GetComponent(RichAI).enabled = false;
but i get the error : Unknown identifier: ‘RichAI’.
is this do to it being written in C# and im enabling from JS.
Go to the A* Inspector, it will probably ask you if you want to enable JS Support, if not, go to Settings -> Editor -> Enable JS Support. That will reorder some folders to make sure that things can be accessed from JS.
when I do that I get this error (link to picture).
Could you show me how your project hierarchy looks?