How to call OnDisable function on RichAI for JS to RichAi(C#)?

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

Hi

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.

Hi

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.

postimg.org/image/fi059naqz/
when I do that I get this error (link to picture).

Could you show me how your project hierarchy looks?