Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Rexx on November 03, 2012, 06:46:59 PM
-
Hey guys,
I've been able to get my event to be trigger by a script external from Playmaker, but I can't figure out how to send data along with the event from script. Anyone tried this?
I kinda figured it would work the same way it does in Playmaker, but it turns out I was wrong.
var eData = new HutongGames.PlayMaker.FsmEventData();
eData.FloatData = Damage;
eData.GameObjectData = Owner;
fsm = hit.transform.gameObject.GetComponent(PlayMakerFSM);
fsm.Fsm.Event("Add Damage");
The second part works, but the first doesn't. The event fires off with no data.
-
New version, still doesn't work. It just fires off the event with no data.
var eData = new HutongGames.PlayMaker.FsmEventData();
eData.FloatData = 2f;
eData.GameObjectData = Owner;
fsm = hit.transform.gameObject.GetComponent(PlayMakerFSM);
if(fsm == null)
Debug.Log("No Playmaker Component");
var ev = fsm.Fsm.GetEvent("Add Damage");
fsm.Fsm.BroadcastEventToGameObject(hit.transform.gameObject,ev,eData,false,false);