Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: speccy666 on January 20, 2016, 02:39:11 PM

Title: [SOLVED] Trying to disable an FSM with Script...
Post by: speccy666 on January 20, 2016, 02:39:11 PM
I suppose this is quite easy for experts... I cannot manage how to disable or enable a FSM from Java script  like : "ObjetFSM.Fsm.enabled=false;"

I tried this but it does not work :
Code: [Select]
    var ObjetFSM : PlayMakerFSM;
    //Surveille l'état des FSM et controle le projet en fonction des clicks utilisateurs
    //Si Porte choisie alors on désactive les autres portes.
   if (ChoixPorte==1)
    {
        // on trouve le FSM sur l'objet en cherchant l'objet et en l'attribuant à une variable déclarée en PlaymakerFSM
        ObjetFSM = gameObject.Find("porte2").GetComponent.<PlayMakerFSM>();
        //On agit sur l'objet
        ObjetFSM.Fsm.enabled=false;
    }
    print(ChoixPorte);
}

Thanks.
Title: Re: [SOLVED] Trying to disable an FSM with Script...
Post by: speccy666 on January 20, 2016, 02:52:17 PM
OK after a hard struggle, I found this really simple :
Instead of :

        ObjetFSM.Fsm.enabled=false;

You type :

        ObjetFSM.enabled=false;