Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: amaranth on September 28, 2012, 02:11:24 PM
-
I've run into a situation where I need to set the Target FSM field in the UIEventsToPlaymakerFSM, using a NGUI script called UIPopupList.
I'm not sure how to get pmEvents.targetFSM to get the game object that has the FSM. I tried using this code to reference the game object, but I get a conversion error, since targetFSM is looking for an FSM component:
var otherGameObject = GameObject.Find("Other");
Anyone know a solution? I'm trying to reference a game object in the Hierarchy called Monitor that contains an FSM called Click.
UIEventsToPlaymakerFSM pmEvents = UIEventsToPlaymakerFSM.Get(lbl.gameObject); //works
pmEvents.onClickEvent = "Item Clicked"; //works
pmEvents.targetFSM = //What goes here?
-
Hi,
never played with that, but the target Fsm is likely a reference to the PlayMaker Component itself-
Fsm are components attached to a gameObject like any other components in Unity.
bye,
Jean
-
Woot, it worked!!!
Added this to NGUI's UIPopupList.cs:
// playmaker event listener
var go = GameObject.Find("Click Monitor");
PlayMakerFSM fsmComponent;
fsmComponent = go.GetComponent<PlayMakerFSM>();
UIEventsToPlaymakerFSM pmEvents = UIEventsToPlaymakerFSM.Get(lbl.gameObject);
pmEvents.onClickEvent = "Item Clicked";
pmEvents.targetFSM = fsmComponent;